]> www.infradead.org Git - users/jedix/linux-maple.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)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 5 Aug 2024 20:18:35 +0000 (20:18 +0000)
commit50438dbc483ca6a133d2bce9d5d6747bcee38371
tree64b8e35b73b5cd710df9cd4dc1116b579e67e77c
parent1cade98cf6415897bf9342ee451cc5b40b58c638
f2fs: avoid potential int overflow in sanity_check_area_boundary()

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>
fs/f2fs/super.c