Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Zero entire stat structure before filling in conten...



details:   https://anonhg.NetBSD.org/src/rev/8c312925a276
branches:  trunk
changeset: 758252:8c312925a276
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Oct 28 20:32:45 2010 +0000

description:
Zero entire stat structure before filling in contents to avoid
leaking kernel memory -- the elements are no longer packed now that
dev_t is 64bit.

from pgoyette

diffstat:

 sys/kern/vfs_vnops.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 10344d72822d -r 8c312925a276 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Thu Oct 28 18:12:47 2010 +0000
+++ b/sys/kern/vfs_vnops.c      Thu Oct 28 20:32:45 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.178 2010/09/21 19:26:19 chs Exp $      */
+/*     $NetBSD: vfs_vnops.c,v 1.179 2010/10/28 20:32:45 pooka Exp $    */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.178 2010/09/21 19:26:19 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.179 2010/10/28 20:32:45 pooka Exp $");
 
 #include "veriexec.h"
 
@@ -611,6 +611,7 @@
        /*
         * Copy from vattr table
         */
+       memset(sb, 0, sizeof(*sb));
        sb->st_dev = va.va_fsid;
        sb->st_ino = va.va_fileid;
        mode = va.va_mode;
@@ -653,7 +654,6 @@
        sb->st_flags = va.va_flags;
        sb->st_gen = 0;
        sb->st_blocks = va.va_bytes / S_BLKSIZE;
-       memset(sb->st_spare, 0, sizeof(sb->st_spare));
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index