]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: check num before bplist[num]
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:01:17 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:42 +0000 (11:37 -0700)
smatch complained about checking an array index before indexing the
array, so fix that.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
repair/prefetch.c

index de36c5fe2cc9d2cd321c741be94376f96a9ea589..22efd54bf9ebf340a9c448815b20293dde96144e 100644 (file)
@@ -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