summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-06-01 05:16:50 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-06-01 05:16:50 +0000
commitc09c0a87b98af5cdace456999f6e1a3a37304c52 (patch)
treea9433aae747801e2eb97f72f6f14d99fbe0761a2
parent3f5f3310a1d7af5fa0fd65890d8d039abdc767f4 (diff)
Make umv_pglistalloc() return EINVAL if it is asked for 0 bytes. This
will prevent panics in, e.g., bus_dmamem_alloc(). ok jason@ art@
-rw-r--r--sys/uvm/uvm_pglist.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/uvm/uvm_pglist.c b/sys/uvm/uvm_pglist.c
index 42ad231fb38..d9ec0cae496 100644
--- a/sys/uvm/uvm_pglist.c
+++ b/sys/uvm/uvm_pglist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pglist.c,v 1.15 2006/01/16 13:11:06 mickey Exp $ */
+/* $OpenBSD: uvm_pglist.c,v 1.16 2006/06/01 05:16:49 krw Exp $ */
/* $NetBSD: uvm_pglist.c,v 1.13 2001/02/18 21:19:08 chs Exp $ */
/*-
@@ -110,6 +110,9 @@ uvm_pglistalloc(size, low, high, alignment, boundary, rlist, nsegs, waitok)
if (alignment < PAGE_SIZE)
alignment = PAGE_SIZE;
+ if (size == 0)
+ return (EINVAL);
+
size = round_page(size);
try = roundup(low, alignment);