Skip to contentSkip to conversation

shmem: Replace IS_ERR() with IS_ERR_OR_NULL

PATCH New Ethan Tidmore 1 participant 1 message Feb 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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")
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
index 805402e8c841..c97e5ff34d03 100644
@@ -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