Commit e001e608 authored by Dan Carpenter's avatar Dan Carpenter Committed by Konstantin Komarov

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: be71b5cb ("fs/ntfs3: Add attrib operations")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 4f1dc7d9
...@@ -107,7 +107,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, ...@@ -107,7 +107,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
return -EFBIG; return -EFBIG;
/* Allocate memory for packed Ea. */ /* 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) if (!ea_p)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment