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: be71b5cba2 ("fs/ntfs3: Add attrib operations")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
Dan Carpenter 2022-09-12 18:08:51 +03:00 committed by Konstantin Komarov
parent 4f1dc7d975
commit e001e60869
No known key found for this signature in database
GPG Key ID: A9B0331F832407B6
1 changed files with 1 additions and 1 deletions

View File

@ -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;