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++) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to