From 03bb1e176989d512179693e2f030435a53c9bb0c Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 31 Mar 2007 22:16:49 +0000 Subject: do nbuf constraint based on KERNEND/KERNBASE to avoid integer overflow from new giant sparc64 kvm; ok kettenis, tested by pooleb --- sys/arch/sparc64/sparc64/machdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index b527f2bc3e7..faf51063204 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.86 2006/12/30 16:25:41 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.87 2007/03/31 22:16:48 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -364,8 +364,8 @@ allocsys(caddr_t v) } /* Restrict to at most 30% filled kvm */ if (nbuf * MAXBSIZE > - (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) * 3 / 10) - nbuf = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / + (KERNEND - KERNBASE) * 3 / 10) + nbuf = (KERNEND - KERNBASE) / MAXBSIZE * 3 / 10; /* More buffer pages than fits into the buffers is senseless. */ -- cgit v1.2.3