fs: proc: Fix error checking for d_hash_and_lookup()
Subsystems (2)
PATCH 1/1 fs: proc: Fix error checking for d_hash_and_lookup()
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 <[email protected]>
--- fs/proc/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/base.c +1 -1
@@ -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))
Signature · 1 line
2.34.1
Christian Brauner
maintainerQuoted 6 lines · 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 <[email protected]>---
I distinctly remember having NAKed a patch like this either earlier this or last year. Procfs doesn't have a custom d_hash() function so d_hash_and_lookup() will never return an error pointer afaict.
Al Viro
maintainerQuoted 3 lines · 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().
Not for procfs it doesn't. Please, don't use that shite.