]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
jfs: UBSAN: shift-out-of-bounds in dbFindBits
authorRemington Brasga <rbrasga@uci.edu>
Wed, 10 Jul 2024 00:12:44 +0000 (00:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:31 +0000 (12:00 +0200)
[ Upstream commit b0b2fc815e514221f01384f39fbfbff65d897e1c ]

Fix issue with UBSAN throwing shift-out-of-bounds warning.

Reported-by: syzbot+e38d703eeb410b17b473@syzkaller.appspotmail.com
Signed-off-by: Remington Brasga <rbrasga@uci.edu>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/jfs/jfs_dmap.c

index 0625d1c0d0649a73531eb8b74545e46e1ca2602e..8847e8c5d5b4532d8c0bd9f8ef0c94011ee3e6de 100644 (file)
@@ -3022,7 +3022,7 @@ static int dbFindBits(u32 word, int l2nb)
 
        /* scan the word for nb free bits at nb alignments.
         */
-       for (bitno = 0; mask != 0; bitno += nb, mask >>= nb) {
+       for (bitno = 0; mask != 0; bitno += nb, mask = (mask >> nb)) {
                if ((mask & word) == mask)
                        break;
        }