Module Name:    src
Committed By:   riastradh
Date:           Sun May  3 06:33:59 UTC 2020

Modified Files:
        src/sys/kern: kern_entropy.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/kern_entropy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.8 src/sys/kern/kern_entropy.c:1.9
--- src/sys/kern/kern_entropy.c:1.8	Fri May  1 01:31:17 2020
+++ src/sys/kern/kern_entropy.c	Sun May  3 06:33:59 2020
@@ -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 @@ rnd_attach_source(struct krndsource *rs,
 	/* 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)

Reply via email to