svn commit: r244080 - head/sys/kern
Andre Oppermann
andre at FreeBSD.org
Mon Dec 10 12:19:04 UTC 2012
Author: andre
Date: Mon Dec 10 12:19:03 2012
New Revision: 244080
URL: http://svnweb.freebsd.org/changeset/base/244080
Log:
Prevent long type overflow of realmem calculation on ILP32 by forcing
calculation to be in quad_t space. Fix style issue with second parameter
to qmin().
Reported by: alc
Reviewed by: bde, alc
Modified:
head/sys/kern/subr_param.c
Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c Mon Dec 10 11:26:18 2012 (r244079)
+++ head/sys/kern/subr_param.c Mon Dec 10 12:19:03 2012 (r244080)
@@ -332,8 +332,8 @@ init_param2(long physpages)
* available kernel memory (physical or kmem).
* At most it can be 3/4 of available kernel memory.
*/
- realmem = qmin(physpages * PAGE_SIZE,
- VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
+ realmem = qmin((quad_t)physpages * PAGE_SIZE,
+ VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
maxmbufmem = realmem / 2;
TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
if (maxmbufmem > (realmem / 4) * 3)
More information about the svn-src-all
mailing list