[PATCH] shmem: Replace IS_ERR() with IS_ERR_OR_NULL
From: Ethan Tidmore
Date: Tue Feb 24 2026 - 14:26:58 EST
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 <ethantidmore06@xxxxxxxxx>
---
mm/shmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 805402e8c841..c97e5ff34d03 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -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;
--
2.53.0