From: Ethan Tidmore <ethantidmore06@gmail.com>
To: Christian Brauner <brauner@kernel.org>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH] shmem: Replace IS_ERR() with IS_ERR_OR_NULL
Date: Tue, 24 Feb 2026 13:25:59 -0600 [thread overview]
Message-ID: <20260224192559.2429005-1-ethantidmore06@gmail.com> (raw)
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
reply other threads:[~2026-02-24 19:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260224192559.2429005-1-ethantidmore06@gmail.com \
--to=ethantidmore06@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox