Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/compat/netbsd32 Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/c8de953aadc2
branches:  netbsd-6
changeset: 776655:c8de953aadc2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jun 26 03:28:47 2014 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1084):
        sys/compat/netbsd32/netbsd32_netbsd.c   rev. 1.187

Fix cases where count <= 0 (thanks to Maxime Villard for raising this).

diffstat:

 sys/compat/netbsd32/netbsd32_netbsd.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 2889346ac321 -r c8de953aadc2 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c     Wed Jun 18 02:03:46 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c     Thu Jun 26 03:28:47 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_netbsd.c,v 1.179.2.1 2014/03/18 08:09:46 msaitoh Exp $        */
+/*     $NetBSD: netbsd32_netbsd.c,v 1.179.2.2 2014/06/26 03:28:47 msaitoh Exp $        */
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.179.2.1 2014/03/18 08:09:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.179.2.2 2014/06/26 03:28:47 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1740,6 +1740,12 @@
        int i, error = 0;
        size_t ksep_len;
 
+       if (count < 0)
+               return EINVAL;
+
+       if (count == 0 || uvmexp.nswapdev == 0)
+               return 0;
+
        /* Make sure userland cannot exhaust kernel memory */
        if ((size_t)count > (size_t)uvmexp.nswapdev)
                count = uvmexp.nswapdev;
@@ -1751,9 +1757,6 @@
        uvm_swap_stats(SWAP_STATS, ksep, count, retval);
        count = *retval;
 
-       if (count < 1)
-               goto out;
-
        for (i = 0; i < count; i++) {
                se32.se_dev = ksep[i].se_dev;
                se32.se_flags = ksep[i].se_flags;
@@ -1768,8 +1771,6 @@
                        break;
        }
 
-       
-out:
        kmem_free(ksep, ksep_len);
 
        return error;



Home | Main Index | Thread Index | Old Index