Skip to contentSkip to conversation

fs/jfs: fix assert failed in dbFindBits()

PATCH New Liu Shixin 1 participant 1 message Nov 2, 2022 JFS filesystem

lore
Share & tools
lore

Liu Shixin

author
#0 lore raw

PATCH 1/1 fs/jfs: fix assert failed in dbFindBits()

syzkaller reported a bug:

BUG at fs/jfs/jfs_dmap.c:2984 assert(bitno < 32)

Since we increased bitno before check (mask != 0) in the loop, the value can reach 32. Modify the assert condition to (bitno <= 32) to fix it.

---
 fs/jfs/jfs_dmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +1 -1
index 6b838d3ae7c2..7bd57728edf3 100644
@@ -2981,7 +2981,7 @@ static int dbFindBits(u32 word, int l2nb)
 			break;
 	}
 
-	ASSERT(bitno < 32);
+	ASSERT(bitno <= 32);
 
 	/* return the bit number.
 	 */
Signature · 1 line
2.25.1