* [PATCH] shmem: Replace IS_ERR() with IS_ERR_OR_NULL
@ 2026-02-24 19:25 Ethan Tidmore
0 siblings, 0 replies; only message in thread
From: Ethan Tidmore @ 2026-02-24 19:25 UTC (permalink / raw)
To: Christian Brauner, Hugh Dickins, Andrew Morton
Cc: Baolin Wang, Darrick J. Wong, linux-mm, linux-kernel, Ethan Tidmore
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@gmail.com>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-24 19:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-24 19:25 [PATCH] shmem: Replace IS_ERR() with IS_ERR_OR_NULL Ethan Tidmore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox