linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] fs: proc: Fix error checking for d_hash_and_lookup()
@ 2024-08-26  9:08 Yan Zhen
  2024-08-26 10:39 ` Christian Brauner
  2024-08-26 13:49 ` Al Viro
  0 siblings, 2 replies; 3+ messages in thread
From: Yan Zhen @ 2024-08-26  9:08 UTC (permalink / raw)
  To: viro, brauner; +Cc: jack, linux-fsdevel, opensource.kernel, Yan Zhen

The d_hash_and_lookup() function returns either an error pointer or NULL.

It might be more appropriate to check error using IS_ERR_OR_NULL().

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
 fs/proc/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index f83d41bf155d..e08b36dd4766 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2123,7 +2123,7 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
 	ino_t ino = 1;
 
 	child = d_hash_and_lookup(dir, &qname);
-	if (!child) {
+	if (IS_ERR_OR_NULL(child)) {
 		DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
 		child = d_alloc_parallel(dir, &qname, &wq);
 		if (IS_ERR(child))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-26 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  9:08 [PATCH v1] fs: proc: Fix error checking for d_hash_and_lookup() Yan Zhen
2024-08-26 10:39 ` Christian Brauner
2024-08-26 13:49 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).