summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-06-13 20:38:55 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-06-13 20:38:55 +0000
commit1d40b5e9685f558e57c73744f63415319219f8a2 (patch)
tree7c6b92863c77d34b580e37b64bb8efcbbe89876e
parent925decb30606e6b1b0efb944499a09f785839502 (diff)
Do memory size calculations as unsigned long. Otherwise
netstat -m would print the result of a signed interger overflow if kern.maxclusters is 1048576 or above. OK claudio@
-rw-r--r--usr.bin/netstat/mbuf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 13ac8e78c11..ad1414b7343 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.c,v 1.40 2017/10/28 15:25:20 mikeb Exp $ */
+/* $OpenBSD: mbuf.c,v 1.41 2019/06/13 20:38:54 bluhm Exp $ */
/* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */
/*
@@ -199,7 +199,7 @@ mbpr(void)
printf("%lu/%lu/%lu Kbytes allocated to network "
"(current/peak/max)\n", totmem / 1024, totpeak / 1024,
- (unsigned long)(maxclusters * MCLBYTES) / 1024);
+ ((unsigned long)maxclusters * MCLBYTES) / 1024);
printf("%lu requests for memory denied\n", mbstat.m_drops);
printf("%lu requests for memory delayed\n", mbstat.m_wait);
printf("%lu calls to protocol drain routines\n", mbstat.m_drain);