Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Make sure struct vattr contains no random bits of k...



details:   https://anonhg.NetBSD.org/src/rev/d79de4b730cd
branches:  trunk
changeset: 750589:d79de4b730cd
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jan 07 19:54:40 2010 +0000

description:
Make sure struct vattr contains no random bits of kernel memory
after vattr_null().  This is especially nice considering things
like puffs, where the contents are copied to userspace.

diffstat:

 sys/kern/vfs_subr.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 0694859723f9 -r d79de4b730cd sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Thu Jan 07 18:57:38 2010 +0000
+++ b/sys/kern/vfs_subr.c       Thu Jan 07 19:54:40 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.392 2009/11/28 10:10:17 bouyer Exp $    */
+/*     $NetBSD: vfs_subr.c,v 1.393 2010/01/07 19:54:40 pooka Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.392 2009/11/28 10:10:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.393 2010/01/07 19:54:40 pooka Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -2665,6 +2665,8 @@
 vattr_null(struct vattr *vap)
 {
 
+       memset(vap, 0, sizeof(*vap));
+
        vap->va_type = VNON;
 
        /*
@@ -2691,7 +2693,6 @@
        vap->va_flags = VNOVAL;
        vap->va_rdev = VNOVAL;
        vap->va_bytes = VNOVAL;
-       vap->va_vaflags = 0;
 }
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))



Home | Main Index | Thread Index | Old Index