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
This commit is contained in:
John Baldwin 2020-01-30 18:28:02 +00:00
parent 53345534c8
commit fbb9879c0c

View File

@ -1583,9 +1583,7 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_blob_itercb_t icb,
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++) {