shmem: Replace IS_ERR() with IS_ERR_OR_NULL
Subsystems (2)
PATCH 1/1 shmem: Replace IS_ERR() with IS_ERR_OR_NULL
The CLASS(simple_xattr) macro can return an error pointer or null. The variable new_xattr is only checked for error pointer.
Add check for null.
Detected by Smatch:mm/shmem.c:4284 shmem_initxattrs() warn:
'new_xattr' can also be NULL
Fixes 200a524407b8d ("shmem: adapt to rhashtable-based simple_xattrs with lazy allocation")
Signed-off-by Ethan Tidmore <[email protected]>
--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
@@ -4277,7 +4277,7 @@ static int shmem_initxattrs(struct inode *inode,for (xattr = xattr_array; xattr->name !=NULL ; xattr++) {CLASS (simple_xattr, new_xattr)(xattr->value, xattr->value_len); -if (IS_ERR (new_xattr)) +if (IS_ERR_OR_NULL (new_xattr))break ; len =strlen (xattr->name) +1 ;
Signature · 1 line
2.53.0