Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Initialize struct krndsource::total to zero.



details:   https://anonhg.NetBSD.org/src/rev/b861496a060f
branches:  trunk
changeset: 971750:b861496a060f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun May 03 06:33:59 2020 +0000

description:
Initialize struct krndsource::total to zero.

Avoids bogus counts reported by `rndctl -l' in the event that the
caller neglected to zero the rndsource ahead of time.

diffstat:

 sys/kern/kern_entropy.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 298469d3aebe -r b861496a060f sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c   Sun May 03 06:31:02 2020 +0000
+++ b/sys/kern/kern_entropy.c   Sun May 03 06:33:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_entropy.c,v 1.8 2020/05/01 01:31:17 riastradh Exp $       */
+/*     $NetBSD: kern_entropy.c,v 1.9 2020/05/03 06:33:59 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.8 2020/05/01 01:31:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.9 2020/05/03 06:33:59 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1467,6 +1467,7 @@
        /* Initialize the random source.  */
        memset(rs->name, 0, sizeof(rs->name)); /* paranoia */
        strlcpy(rs->name, name, sizeof(rs->name));
+       rs->total = 0;
        rs->type = type;
        rs->flags = flags;
        if (E->stage >= ENTROPY_WARM)



Home | Main Index | Thread Index | Old Index