Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern avoid integer overflow during computation of nbuf. ...
details: https://anonhg.NetBSD.org/src/rev/1b687e8037ed
branches: trunk
changeset: 535526:1b687e8037ed
user: itojun <itojun%NetBSD.org@localhost>
date: Wed Aug 21 02:48:54 2002 +0000
description:
avoid integer overflow during computation of nbuf. from enami
diffstat:
sys/kern/kern_allocsys.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (35 lines):
diff -r c79301437576 -r 1b687e8037ed sys/kern/kern_allocsys.c
--- a/sys/kern/kern_allocsys.c Wed Aug 21 01:27:58 2002 +0000
+++ b/sys/kern/kern_allocsys.c Wed Aug 21 02:48:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_allocsys.c,v 1.18 2001/11/12 15:25:05 lukem Exp $ */
+/* $NetBSD: kern_allocsys.c,v 1.19 2002/08/21 02:48:54 itojun Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_allocsys.c,v 1.18 2001/11/12 15:25:05 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_allocsys.c,v 1.19 2002/08/21 02:48:54 itojun Exp $");
#include "opt_bufcache.h"
#include "opt_callout.h"
@@ -171,7 +171,6 @@
panic("bufcache is out of range (%d)\n",
bufcache);
bufpages = physmem / 100 * bufcache;
-
} else {
if (physmem < btoc(2 * 1024 * 1024))
bufpages = physmem / 10;
@@ -206,7 +205,7 @@
* XXX stopgap measure to prevent wasting too much KVM on
* the sparsely filled buffer cache.
*/
- if (nbuf * MAXBSIZE > VM_MAX_KERNEL_BUF)
+ if (nbuf > VM_MAX_KERNEL_BUF / MAXBSIZE)
nbuf = VM_MAX_KERNEL_BUF / MAXBSIZE;
#endif
Home |
Main Index |
Thread Index |
Old Index