From: Darrick J. Wong Date: Mon, 22 Apr 2024 17:01:17 +0000 (-0700) Subject: xfs_repair: check num before bplist[num] X-Git-Tag: v6.9.0~13^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=842676ed999f0baae79c3de3ad6e2d3b90733f49;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: check num before bplist[num] smatch complained about checking an array index before indexing the array, so fix that. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/repair/prefetch.c b/repair/prefetch.c index de36c5fe..22efd54b 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -494,7 +494,7 @@ pf_batch_read( args->last_bno_read, &fsbno); max_fsbno = fsbno + pf_max_fsbs; } - while (bplist[num] && num < MAX_BUFS && fsbno < max_fsbno) { + while (num < MAX_BUFS && bplist[num] && fsbno < max_fsbno) { /* * Discontiguous buffers need special handling, so stop * gathering new buffers and process the list and this