ext4: simplify 32bit calculation of lblk
PATCH v2 1/1 ext4: simplify 32bit calculation of lblk
commit <ad4fb9cafe100a> (ext4: fix 32bit overflow in ext4_ext_find_goal()) uses value compare to fix 32bit overflow. The resion is that (block - ext_block) will overflow and cast u32 to u64.
eg: -1(u32) cast to 0xffffffff(u64) which wasn't correct here. Remove the brackets will solve it simply.
Suggested-by David Laight <[email protected]>
Signed-off-by wuchi <[email protected]>
--- fs/ext4/extents.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ext4/extents.c +1 -4
@@ -237,10 +237,7 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode,ext4_fsblk_t ext_pblk =ext4_ext_pblock (ex);ext4_lblk_t ext_block =le32_to_cpu (ex->ee_block); -if (block > ext_block) -return ext_pblk + (block - ext_block); -else -return ext_pblk - (ext_block - block); +return ext_pblk + block - ext_block; }/* it looks like index is empty;
Signature · 1 line
2.20.1