svn commit: r357302 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Thu Jan 30 18:28:03 UTC 2020


Author: jhb
Date: Thu Jan 30 18:28:02 2020
New Revision: 357302
URL: https://svnweb.freebsd.org/changeset/base/357302

Log:
  Fix use of an uninitialized variable.
  
  ctx (and thus ctx.flags) is stack garbage at the start of this
  function, so initialize ctx.flags to an explicit value instead of
  using binary operations on the garbage.
  
  Reported by:	gcc9
  Reviewed by:	imp
  Differential Revision:	https://reviews.freebsd.org/D23368

Modified:
  head/sys/kern/subr_stats.c

Modified: head/sys/kern/subr_stats.c
==============================================================================
--- head/sys/kern/subr_stats.c	Thu Jan 30 18:12:41 2020	(r357301)
+++ head/sys/kern/subr_stats.c	Thu Jan 30 18:28:02 2020	(r357302)
@@ -1583,9 +1583,7 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl
 	int i, j, firstvoi;
 
 	ctx.usrctx = usrctx;
-	ctx.flags |= SB_IT_FIRST_CB;
-	ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT |
-	    SB_IT_LAST_VOISTAT);
+	ctx.flags = SB_IT_FIRST_CB;
 	firstvoi = 1;
 
 	for (i = 0; i < NVOIS(sb); i++) {


More information about the svn-src-head mailing list