diff options
author | Colin Ian King <colin.king@canonical.com> | 2021-08-16 18:30:25 +0200 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-08-27 16:05:10 +0200 |
commit | 71eeb6ace80be7389d942b9647765417e5b039f7 (patch) | |
tree | 1445c0fd8c145c02786f3cab2ef6ed814b11ccb8 /fs/ntfs3 | |
parent | fs/ntfs3: Add ifndef + define to all header files (diff) | |
download | linux-71eeb6ace80be7389d942b9647765417e5b039f7.tar.xz linux-71eeb6ace80be7389d942b9647765417e5b039f7.zip |
fs/ntfs3: Fix integer overflow in multiplication
The multiplication of the u32 data_size with a int is being performed
using 32 bit arithmetic however the results is being assigned to the
variable nbits that is a size_t (64 bit) value. Fix a potential
integer overflow by casting the u32 value to a size_t before the
multiply to use a size_t sized bit multiply operation.
Addresses-Coverity: ("Unintentional integer overflow")
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r-- | fs/ntfs3/index.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 6aa9540ece47..9386c551e208 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -2012,7 +2012,7 @@ static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni, unsigned long pos; const unsigned long *bm = resident_data(b); - nbits = le32_to_cpu(b->res.data_size) * 8; + nbits = (size_t)le32_to_cpu(b->res.data_size) * 8; if (bit >= nbits) return 0; |