]> 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>
Fri, 4 Oct 2024 14:33:38 +0000 (16:33 +0200)
commit7686e9c32ae988180c3d51f3e18f29a6e4f90d2d
tree13de1fb671d02f990b8da788d62f14c2d1ca0089
parent9e34807b75febe8f5b1f41eee7590ce5cc721f7e
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