diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-09-12 17:08:51 +0200 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-09-30 16:39:53 +0200 |
commit | e001e60869390686809663c02bceb1d3922548fb (patch) | |
tree | 1ef930f43eec97563640de49eab2a2a94dba6b56 /fs/ntfs3 | |
parent | fs/ntfs3: Validate attribute name offset (diff) | |
download | linux-e001e60869390686809663c02bceb1d3922548fb.tar.xz linux-e001e60869390686809663c02bceb1d3922548fb.zip |
fs/ntfs3: Harden against integer overflows
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>
Diffstat (limited to 'fs/ntfs3')
-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 6ae1f56b7358..2b4019ecd004 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; |