Skip to content

Commit e001e60

Browse files
Dan Carpenteraalexandrovich
authored andcommitted
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: be71b5c ("fs/ntfs3: Add attrib operations") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 4f1dc7d commit e001e60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ntfs3/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
107107
return -EFBIG;
108108

109109
/* Allocate memory for packed Ea. */
110-
ea_p = kmalloc(size + add_bytes, GFP_NOFS);
110+
ea_p = kmalloc(size_add(size, add_bytes), GFP_NOFS);
111111
if (!ea_p)
112112
return -ENOMEM;
113113

0 commit comments

Comments
 (0)