diff mbox series

[1/1] xfs_repair: check num before bplist[num]

Message ID 171634535088.2483183.10391462553150482336.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/1] xfs_repair: check num before bplist[num] | expand

Commit Message

Darrick J. Wong May 22, 2024, 3:21 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/repair/prefetch.c b/repair/prefetch.c
index de36c5fe2..22efd54bf 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