Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by simo...



details:   https://anonhg.NetBSD.org/src/rev/f297577ba180
branches:  netbsd-9
changeset: 368517:f297577ba180
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jul 17 10:34:10 2022 +0000

description:
Pull up following revision(s) (requested by simonb in ticket #1479):

        sys/kern/subr_pool.c: revision 1.285

Use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output for kernel pool pages
in "vmstat -s" output.

diffstat:

 sys/kern/subr_pool.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 0dc721baae32 -r f297577ba180 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Fri Jul 15 17:18:23 2022 +0000
+++ b/sys/kern/subr_pool.c      Sun Jul 17 10:34:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $       */
+/*     $NetBSD: subr_pool.c,v 1.252.2.4 2022/07/17 10:34:10 martin Exp $       */
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.4 2022/07/17 10:34:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1678,10 +1678,11 @@
        uint64_t total = 0;
 
        TAILQ_FOREACH(pp, &pool_head, pr_poollist) {
-               uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz;
+               uint64_t bytes =
+                   (uint64_t)pp->pr_npages * pp->pr_alloc->pa_pagesz;
 
                if ((pp->pr_roflags & PR_RECURSIVE) != 0)
-                       bytes -= (pp->pr_nout * pp->pr_size);
+                       bytes -= ((uint64_t)pp->pr_nout * pp->pr_size);
                total += bytes;
        }
 



Home | Main Index | Thread Index | Old Index