Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Use copyout to copy data from kernel out to userland!



details:   https://anonhg.NetBSD.org/src/rev/3d98692bb9cc
branches:  trunk
changeset: 782761:3d98692bb9cc
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Nov 19 15:01:17 2012 +0000

description:
Use copyout to copy data from kernel out to userland!
Fixes PR kern/47217.

diffstat:

 sys/kern/vfs_syscalls.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 537679ef4ccc -r 3d98692bb9cc sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Mon Nov 19 13:45:00 2012 +0000
+++ b/sys/kern/vfs_syscalls.c   Mon Nov 19 15:01:17 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.460 2012/11/18 17:41:53 manu Exp $  */
+/*     $NetBSD: vfs_syscalls.c,v 1.461 2012/11/19 15:01:17 martin Exp $        */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.460 2012/11/18 17:41:53 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.461 2012/11/19 15:01:17 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3115,14 +3115,19 @@
                syscallarg(int) flag;
        } */
        unsigned int nd_flag;
+       struct stat sb;
+       int error;
 
        if (SCARG(uap, flag) & AT_SYMLINK_NOFOLLOW)
                nd_flag = NOFOLLOW;
        else
                nd_flag = FOLLOW;
 
-       return do_sys_statat(l, SCARG(uap, fd), SCARG(uap, path), nd_flag, 
-           SCARG(uap, buf));
+       error = do_sys_statat(l, SCARG(uap, fd), SCARG(uap, path), nd_flag, 
+           &sb);
+       if (error)
+               return error;
+       return copyout(&sb, SCARG(uap, buf), sizeof(sb));
 }
 
 /*



Home | Main Index | Thread Index | Old Index