Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Sync swapctl() with netbsd32. Return EINVAL when misc<0, ...
details: https://anonhg.NetBSD.org/src/rev/7e44350cb530
branches: trunk
changeset: 330092:7e44350cb530
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Jun 22 19:09:39 2014 +0000
description:
Sync swapctl() with netbsd32. Return EINVAL when misc<0, and 0 when misc=0
or uvmexp.nswapdev=0.
diffstat:
sys/compat/netbsd32/netbsd32_netbsd.c | 6 ++----
sys/uvm/uvm_swap.c | 16 ++++++++++------
2 files changed, 12 insertions(+), 10 deletions(-)
diffs (69 lines):
diff -r 125e1e22ba9a -r 7e44350cb530 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c Sun Jun 22 18:32:27 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c Sun Jun 22 19:09:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_netbsd.c,v 1.189 2014/06/13 10:37:02 joerg Exp $ */
+/* $NetBSD: netbsd32_netbsd.c,v 1.190 2014/06/22 19:09:39 maxv 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.189 2014/06/13 10:37:02 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.190 2014/06/22 19:09:39 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
@@ -1765,10 +1765,8 @@
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;
diff -r 125e1e22ba9a -r 7e44350cb530 sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c Sun Jun 22 18:32:27 2014 +0000
+++ b/sys/uvm/uvm_swap.c Sun Jun 22 19:09:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.168 2014/03/16 05:20:30 dholland Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.169 2014/06/22 19:09:39 maxv Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.168 2014/03/16 05:20:30 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.169 2014/06/22 19:09:39 maxv Exp $");
#include "opt_uvmhist.h"
#include "opt_compat_netbsd.h"
@@ -492,13 +492,17 @@
|| SCARG(uap, cmd) == SWAP_STATS13
#endif
) {
- if ((size_t)misc > (size_t)uvmexp.nswapdev)
- misc = uvmexp.nswapdev;
-
- if (misc == 0) {
+ if (misc < 0) {
error = EINVAL;
goto out;
}
+ if (misc == 0 || uvmexp.nswapdev == 0) {
+ error = 0;
+ goto out;
+ }
+ /* Make sure userland cannot exhaust kernel memory */
+ if ((size_t)misc > (size_t)uvmexp.nswapdev)
+ misc = uvmexp.nswapdev;
KASSERT(misc > 0);
#if defined(COMPAT_13)
if (SCARG(uap, cmd) == SWAP_STATS13)
Home |
Main Index |
Thread Index |
Old Index