All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/jfs: fix assert failed in dbFindBits()
@ 2022-11-02  9:43 Liu Shixin
  0 siblings, 0 replies; only message in thread
From: Liu Shixin @ 2022-11-02  9:43 UTC (permalink / raw)
  To: Dave Kleikamp; +Cc: jfs-discussion, linux-kernel, Liu Shixin

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.

Reported-by: syzbot+c6357942fbe0fce51c76@syzkaller.appspotmail.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 fs/jfs/jfs_dmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 6b838d3ae7c2..7bd57728edf3 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2981,7 +2981,7 @@ static int dbFindBits(u32 word, int l2nb)
 			break;
 	}
 
-	ASSERT(bitno < 32);
+	ASSERT(bitno <= 32);
 
 	/* return the bit number.
 	 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-02  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02  9:43 [PATCH] fs/jfs: fix assert failed in dbFindBits() Liu Shixin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.