Source-Changes-HG archive

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

[src/trunk]: src/sys/kern The whole 'tv' structure gets added to the RND pool...



details:   https://anonhg.NetBSD.org/src/rev/f1b263555083
branches:  trunk
changeset: 1000112:f1b263555083
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jul 07 15:12:59 2019 +0000

description:
The whole 'tv' structure gets added to the RND pool, so clear it first,
otherwise each random buffer gets tainted by uninitialized bytes from the
padding.

diffstat:

 sys/kern/kern_todr.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 7a39ec9c8887 -r f1b263555083 sys/kern/kern_todr.c
--- a/sys/kern/kern_todr.c      Sun Jul 07 12:58:45 2019 +0000
+++ b/sys/kern/kern_todr.c      Sun Jul 07 15:12:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_todr.c,v 1.39 2015/04/13 16:36:54 riastradh Exp $ */
+/*     $NetBSD: kern_todr.c,v 1.40 2019/07/07 15:12:59 maxv Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -41,7 +41,7 @@
 #include "opt_todr.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.39 2015/04/13 16:36:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.40 2019/07/07 15:12:59 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -113,6 +113,8 @@
        if (todr_handle)
                todr_handle->base_time = base;
 
+       memset(&tv, 0, sizeof(tv));
+
        if ((todr_handle == NULL) ||
            (todr_gettime(todr_handle, &tv) != 0) ||
            (tv.tv_sec < (25 * SECS_PER_COMMON_YEAR))) {



Home | Main Index | Thread Index | Old Index