[PATCH 2/3] fs: ubifs: Need to check return for being an error pointer
Andrew Goodbody
andrew.goodbody at linaro.org
Fri Oct 3 12:42:51 CEST 2025
The return value from alloc_super can be an error pointer so the error
check needs to detect this as well as checking the pointer for being
NULL.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
fs/ubifs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 7718081f0937ce038f5237256caadc40630ae050..b6004b88f4ea215fbdd41ec97da5f28d1eb5e96c 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2425,7 +2425,7 @@ retry:
if (!s) {
spin_unlock(&sb_lock);
s = alloc_super(type, flags);
- if (!s)
+ if (IS_ERR_OR_NULL(s))
return ERR_PTR(-ENOMEM);
#ifndef __UBOOT__
goto retry;
--
2.47.3
More information about the U-Boot
mailing list