Fix from Niklas Hallqvist / Chuck Cranor / Michael Hitch / OpenBSD to avoid

integer overflow in initial pmap setup.  Triggerred by high values for
maxusers.
This commit is contained in:
briggs 1995-12-03 13:52:50 +00:00
parent 52ec09e420
commit 99e494a984
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.21 1995/10/10 04:14:30 briggs Exp $ */
/* $NetBSD: pmap.c,v 1.22 1995/12/03 13:52:50 briggs Exp $ */
/*
* Copyright (c) 1991, 1993
@ -474,7 +474,8 @@ pmap_init()
* map where we want it.
*/
addr = MAC_PTBASE;
s = min(MAC_PTMAXSIZE, maxproc*MAC_MAX_PTSIZE);
s = (MAC_PTMAXSIZE / MAC_MAX_PTSIZE < maxproc) ?
MAC_PTMAXSIZE : (maxproc * MAC_MAX_PTSIZE);
addr2 = addr + s;
rv = vm_map_find(kernel_map, NULL, 0, &addr, s, TRUE);
if (rv != KERN_SUCCESS)