Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Swap kernel/curproc tests in copy*_vmspace so rump ...



details:   https://anonhg.NetBSD.org/src/rev/31b9c4c9e7eb
branches:  trunk
changeset: 336961:31b9c4c9e7eb
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 28 16:13:38 2015 +0000

description:
Swap kernel/curproc tests in copy*_vmspace so rump can catch EFAULT.

diffstat:

 sys/kern/subr_copy.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r b8a51a7e912e -r 31b9c4c9e7eb sys/kern/subr_copy.c
--- a/sys/kern/subr_copy.c      Sat Mar 28 15:59:29 2015 +0000
+++ b/sys/kern/subr_copy.c      Sat Mar 28 16:13:38 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_copy.c,v 1.1 2009/11/04 16:54:00 pooka Exp $      */
+/*     $NetBSD: subr_copy.c,v 1.2 2015/03/28 16:13:38 riastradh Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.1 2009/11/04 16:54:00 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.2 2015/03/28 16:13:38 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/fcntl.h>
@@ -211,12 +211,12 @@
        if (len == 0)
                return (0);
 
+       if (__predict_true(vm == curproc->p_vmspace)) {
+               return copyin(uaddr, kaddr, len);
+       }
        if (VMSPACE_IS_KERNEL_P(vm)) {
                return kcopy(uaddr, kaddr, len);
        }
-       if (__predict_true(vm == curproc->p_vmspace)) {
-               return copyin(uaddr, kaddr, len);
-       }
 
        iov.iov_base = kaddr;
        iov.iov_len = len;
@@ -244,12 +244,12 @@
        if (len == 0)
                return (0);
 
+       if (__predict_true(vm == curproc->p_vmspace)) {
+               return copyout(kaddr, uaddr, len);
+       }
        if (VMSPACE_IS_KERNEL_P(vm)) {
                return kcopy(kaddr, uaddr, len);
        }
-       if (__predict_true(vm == curproc->p_vmspace)) {
-               return copyout(kaddr, uaddr, len);
-       }
 
        iov.iov_base = __UNCONST(kaddr); /* XXXUNCONST cast away const */
        iov.iov_len = len;



Home | Main Index | Thread Index | Old Index