From 6b217c913eb9e9a8ef7d6c02c53cd41e4a1366c9 Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Thu, 1 Nov 2001 14:31:26 +0000 Subject: Don't allow negative offsets. Some type confusion. --- sys/uvm/uvm_device.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/uvm/uvm_device.c b/sys/uvm/uvm_device.c index 2430fc5ef17..b61ff7d7157 100644 --- a/sys/uvm/uvm_device.c +++ b/sys/uvm/uvm_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_device.c,v 1.13 2001/11/01 12:13:47 art Exp $ */ +/* $OpenBSD: uvm_device.c,v 1.14 2001/11/01 14:31:25 art Exp $ */ /* $NetBSD: uvm_device.c,v 1.22 2000/05/28 10:21:55 drochner Exp $ */ /* @@ -149,6 +149,9 @@ udv_attach(arg, accessprot, off, size) mapfn == (paddr_t (*) __P((dev_t, off_t, int)))nullop) return(NULL); + if (off < 0) + return (NULL); + /* * Check that the specified range of the device allows the * desired protection. @@ -408,8 +411,8 @@ udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) struct uvm_device *udv = (struct uvm_device *)uobj; vaddr_t curr_va; int curr_offset; - paddr_t paddr; - int lcv, retval, mdpgno; + paddr_t paddr, mdpgno; + int lcv, retval; dev_t device; paddr_t (*mapfn) __P((dev_t, off_t, int)); vm_prot_t mapprot; -- cgit v1.2.3