]> 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, 17 Oct 2024 13:08:14 +0000 (15:08 +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 801996da08a45b2371893c38d5c1cc249a5a17e1..750853367d4ff5754a3976ebd0e7fc5852473671 100644 (file)
@@ -3084,7 +3084,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;
        }