diff options
| author | Dan Carpenter <dan.carpenter@linaro.org> | 2025-02-16 23:52:00 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:44:30 +0200 |
| commit | 4d0f4f42922a832388a0c2fe5204c0a1037ff786 (patch) | |
| tree | b47249eebb01f1a40f7969e7873881f49aab43a8 /fs | |
| parent | e0f7dcd19f10454e790335722504a3b771bd9589 (diff) | |
| download | linux-4d0f4f42922a832388a0c2fe5204c0a1037ff786.tar.gz linux-4d0f4f42922a832388a0c2fe5204c0a1037ff786.tar.bz2 linux-4d0f4f42922a832388a0c2fe5204c0a1037ff786.zip | |
fs/ntfs3: Fix a couple integer overflows on 32bit systems
[ Upstream commit 5ad414f4df2294b28836b5b7b69787659d6aa708 ]
On 32bit systems the "off + sizeof(struct NTFS_DE)" addition can
have an integer wrapping issue. Fix it by using size_add().
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ntfs3/index.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 7eb9fae22f8d..78d20e4baa2c 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -618,7 +618,7 @@ static bool index_hdr_check(const struct INDEX_HDR *hdr, u32 bytes) u32 off = le32_to_cpu(hdr->de_off); if (!IS_ALIGNED(off, 8) || tot > bytes || end > tot || - off + sizeof(struct NTFS_DE) > end) { + size_add(off, sizeof(struct NTFS_DE)) > end) { /* incorrect index buffer. */ return false; } @@ -736,7 +736,7 @@ fill_table: if (end > total) return NULL; - if (off + sizeof(struct NTFS_DE) > end) + if (size_add(off, sizeof(struct NTFS_DE)) > end) return NULL; e = Add2Ptr(hdr, off); |
