Patch "fs/jfs: fix potential integer overflow on shift of a int" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs/jfs: fix potential integer overflow on shift of a int

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-jfs-fix-potential-integer-overflow-on-shift-of-a-.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2f4a140806e6fa24c470ef9cbd04cac494c88dee
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date:   Thu Feb 11 13:01:08 2021 +0000

    fs/jfs: fix potential integer overflow on shift of a int
    
    [ Upstream commit 4208c398aae4c2290864ba15c3dab7111f32bec1 ]
    
    The left shift of int 32 bit integer constant 1 is evaluated using 32 bit
    arithmetic and then assigned to a signed 64 bit integer. In the case where
    l2nb is 32 or more this can lead to an overflow.  Avoid this by shifting
    the value 1LL instead.
    
    Addresses-Coverity: ("Uninitentional integer overflow")
    Fixes: b40c2e665cd5 ("fs/jfs: TRIM support for JFS Filesystem")
    Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index caade185e568d..6fe82ce8663ef 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1656,7 +1656,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
 		} else if (rc == -ENOSPC) {
 			/* search for next smaller log2 block */
 			l2nb = BLKSTOL2(nblocks) - 1;
-			nblocks = 1 << l2nb;
+			nblocks = 1LL << l2nb;
 		} else {
 			/* Trim any already allocated blocks */
 			jfs_error(bmp->db_ipbmap->i_sb, "-EIO\n");



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux