]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: avoid potential int overflow in sanity_check_area_boundary()
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Wed, 24 Jul 2024 17:51:58 +0000 (10:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:14 +0000 (15:11 +0200)
commitdc9a23d3b4ee107d4103554d8ba235139ee558a7
tree9dfd7f7cdf4753f4879966e766d96f2d36416e0f
parentafb5da22a7fab9419cddee5265f073484c4a4b9d
f2fs: avoid potential int overflow in sanity_check_area_boundary()

commit 50438dbc483ca6a133d2bce9d5d6747bcee38371 upstream.

While calculating the end addresses of main area and segment 0, u32
may be not enough to hold the result without the danger of int
overflow.

Just in case, play it safe and cast one of the operands to a
wider type (u64).

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: fd694733d523 ("f2fs: cover large section in sanity check of super")
Cc: stable@vger.kernel.org
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/super.c