Change memguard_fudge() so that it can handle km_max being zero. Not
every platform defines VM_KMEM_SIZE_MAX, and on those platforms km_max will be zero. Reviewed by: mdf Tested by: marius
This commit is contained in:
parent
69be0c5ea2
commit
7984ab250b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216425
@ -184,9 +184,10 @@ memguard_fudge(unsigned long km_size, unsigned long km_max)
|
||||
memguard_mapsize = km_max / vm_memguard_divisor;
|
||||
/* size must be multiple of PAGE_SIZE */
|
||||
memguard_mapsize = round_page(memguard_mapsize);
|
||||
if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs)
|
||||
if (memguard_mapsize == 0 ||
|
||||
memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs)
|
||||
memguard_mapsize = mem_pgs * 2 * PAGE_SIZE;
|
||||
if (km_size + memguard_mapsize > km_max)
|
||||
if (km_max > 0 && km_size + memguard_mapsize > km_max)
|
||||
return (km_max);
|
||||
return (km_size + memguard_mapsize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user