Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs Make sure to expand "freepages" to 64bit before...



details:   https://anonhg.NetBSD.org/src/rev/5eb1f3408b4d
branches:  trunk
changeset: 796566:5eb1f3408b4d
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 10 15:44:27 2014 +0000

description:
Make sure to expand "freepages" to 64bit before shifting to byte values -
on rump we may have all our virtual address space "free".
Pointed out by pooka@.

diffstat:

 sys/fs/tmpfs/tmpfs_mem.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r d46b0e40ddc5 -r 5eb1f3408b4d sys/fs/tmpfs/tmpfs_mem.c
--- a/sys/fs/tmpfs/tmpfs_mem.c  Tue Jun 10 14:00:56 2014 +0000
+++ b/sys/fs/tmpfs/tmpfs_mem.c  Tue Jun 10 15:44:27 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_mem.c,v 1.6 2014/06/07 09:54:34 martin Exp $     */
+/*     $NetBSD: tmpfs_mem.c,v 1.7 2014/06/10 15:44:27 martin Exp $     */
 
 /*
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_mem.c,v 1.6 2014/06/07 09:54:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_mem.c,v 1.7 2014/06/10 15:44:27 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -123,7 +123,8 @@
        } else {
                freepages -= uvmexp.freetarg;
        }
-       avail_mem = round_page(mp->tm_bytes_used) + (freepages << PAGE_SHIFT);
+       avail_mem = round_page(mp->tm_bytes_used)
+           + ((uint64_t)freepages << PAGE_SHIFT);
        return MIN(mp->tm_mem_limit, avail_mem);
 }
 



Home | Main Index | Thread Index | Old Index