[PATCH 1/3] fs: ext4fs: Do not negate error before returning it

Andrew Goodbody andrew.goodbody at linaro.org
Fri Jul 4 14:32:42 CEST 2025


In ext4fs_readdir it calls ext4fs_read_file and checks the return value
for non-zero to detect an error. This return value should be returned as
is rather than being negated.

This issue found by Smatch

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 fs/ext4/ext4fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 1727da2dc6d..7fb4c1b755b 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -272,7 +272,7 @@ int ext4fs_readdir(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp)
 				       sizeof(struct ext2_dirent),
 				       (char *)&dirent, &actread);
 		if (ret < 0)
-			return -ret;
+			return ret;
 
 		if (!dirent.direntlen)
 			return -EIO;

-- 
2.39.5



More information about the U-Boot mailing list