diff options
author | Dan Carpenter | 2022-09-12 18:08:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman | 2022-12-31 13:32:46 +0100 |
commit | b259e31d150a9a6be986e1667793e39074866f6e (patch) | |
tree | f3435538dfc5853af92503cd6e9cfb890c5c45df | |
parent | 95afb464c86c6e9e95ea9e595282fa6f693072e8 (diff) |
fs/ntfs3: Harden against integer overflows
[ Upstream commit e001e60869390686809663c02bceb1d3922548fb ]
Smatch complains that the "add_bytes" is not to be trusted. Use
size_add() to prevent an integer overflow.
Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/ntfs3/xattr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 7de8718c68a9..ea582b4fe1d9 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -107,7 +107,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, return -EFBIG; /* Allocate memory for packed Ea. */ - ea_p = kmalloc(size + add_bytes, GFP_NOFS); + ea_p = kmalloc(size_add(size, add_bytes), GFP_NOFS); if (!ea_p) return -ENOMEM; |