summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-27 22:27:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-27 22:27:00 +0000
commit8d488e2a77ae000baef9b8aa9f105c14ffea935a (patch)
tree403034576f2af7c508a42c073eefab82f4373b9e /sys
parent1b9fb5d1f367934db39e880ded794cc73ada09f0 (diff)
from netbsd; Fix possible integer overflow when allocating PT map
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/atari/atari/pmap.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/arch/atari/atari/pmap.c b/sys/arch/atari/atari/pmap.c
index ca2eb527895..9a1ff4963ad 100644
--- a/sys/arch/atari/atari/pmap.c
+++ b/sys/arch/atari/atari/pmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.7 1995/11/30 00:57:39 jtc Exp $ */
+/* $NetBSD: pmap.c,v 1.8 1995/12/25 14:13:53 leo Exp $ */
/*
* Copyright (c) 1991 Regents of the University of California.
@@ -356,7 +356,6 @@ pmap_bootstrap_alloc(size)
return((void *) val);
}
-
/*
* Initialize the pmap module.
* Called by vm_init, to initialize any structures that the pmap
@@ -493,7 +492,18 @@ pmap_init(phys_start, phys_end)
* map where we want it.
*/
addr = ATARI_UPTBASE;
- s = min(ATARI_UPTMAXSIZE, maxproc * ATARI_UPTSIZE);
+ if (ATARI_UPTMAXSIZE / ATARI_UPTSIZE < maxproc) {
+ s = ATARI_UPTMAXSIZE;
+
+ /*
+ * XXX We don't want to hang when we run out of page
+ * tables, so we lower maxproc so that fork will fail
+ * instead. Note that root could still raise this
+ * value through sysctl(2).
+ */
+ maxproc = ATARI_UPTMAXSIZE / ATARI_UPTSIZE;
+ }
+ else s = maxproc * ATARI_UPTSIZE;
addr2 = addr + s;
rv = vm_map_find(kernel_map, NULL, 0, &addr, s, TRUE);
if (rv != KERN_SUCCESS)