summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-02-11 13:01:08 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-04 09:39:42 +0100
commit98a5971b9421fdaab5fbb9d547f94f31b59353d1 (patch)
tree6121c307dda28744162ba86da77240e95d2f65ba /fs
parent14145d3ad8841ee5c0621f923e14ef877c160c7b (diff)
downloadlinux-stable-98a5971b9421fdaab5fbb9d547f94f31b59353d1.tar.gz
linux-stable-98a5971b9421fdaab5fbb9d547f94f31b59353d1.tar.bz2
linux-stable-98a5971b9421fdaab5fbb9d547f94f31b59353d1.zip
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@canonical.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_dmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 49263e220dbc..687b07b9b4f6 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1669,7 +1669,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");