Commit 86211a2d authored by Baokun Li's avatar Baokun Li
Browse files

ext4: add two helper functions extent_logical_end() and pa_logical_end()

stable inclusion
from stable-v5.10.200
commit c0db17e55ff6105f04f8fddc3a0a8d381315e929
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8PI1H
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c0db17e55ff6105f04f8fddc3a0a8d381315e929



--------------------------------

commit 43bbddc0 upstream.

When we use lstart + len to calculate the end of free extent or prealloc
space, it may exceed the maximum value of 4294967295(0xffffffff) supported
by ext4_lblk_t and cause overflow, which may lead to various problems.

Therefore, we add two helper functions, extent_logical_end() and
pa_logical_end(), to limit the type of end to loff_t, and also convert
lstart to loff_t for calculation to avoid overflow.

Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
Reviewed-by: default avatarRitesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20230724121059.11834-2-libaokun1@huawei.com


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
parent acbbc49d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment