Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs Avoid overflow of nfs_commitsize on machines with > ...



details:   https://anonhg.NetBSD.org/src/rev/569351ac5eee
branches:  trunk
changeset: 373910:569351ac5eee
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Mar 17 00:46:35 2023 +0000

description:
Avoid overflow of nfs_commitsize on machines with > 32GB RAM.

diffstat:

 sys/nfs/nfs_vfsops.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r a0e6f8f21784 -r 569351ac5eee sys/nfs/nfs_vfsops.c
--- a/sys/nfs/nfs_vfsops.c      Thu Mar 16 07:20:28 2023 +0000
+++ b/sys/nfs/nfs_vfsops.c      Fri Mar 17 00:46:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $ */
+/*     $NetBSD: nfs_vfsops.c,v 1.244 2023/03/17 00:46:35 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1989, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.244 2023/03/17 00:46:35 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_nfs.h"
@@ -1135,6 +1135,7 @@
 void
 nfs_vfs_init(void)
 {
+       unsigned scale;
 
        /* Initialize NFS server / client shared data. */
        nfs_init();
@@ -1145,7 +1146,8 @@
        /* Initialize the iod structures */
        nfs_iodinit();
 
-       nfs_commitsize = uvmexp.npages << (PAGE_SHIFT - 4);
+       scale = PAGE_SHIFT - 4;
+       nfs_commitsize = uimin(uvmexp.npages, INT_MAX >> scale) << scale;
 }
 
 void



Home | Main Index | Thread Index | Old Index