fs/jfs: fix potential integer overflow on shift of a int
authorColin Ian King <colin.king@canonical.com>
Thu, 11 Feb 2021 13:01:08 +0000 (13:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:51 +0000 (11:37 +0100)
commita6b56338a91046c7b637901e5686d561be7ebe4a
tree7cb373efbb72e701e42bcf6d97ea4cdad09489b0
parentd5f8088cfc9826a0a0928c0872929b4a3abf653e
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>
fs/jfs/jfs_dmap.c