Skip to contentSkip to conversation

fs/squashfs: Set ret to 0 on successful read

PATCH In review Michael Zimmermann 4 participants 4 messages Apr 20 – Apr 25 SquashFS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/squashfs: Set ret to 0 on successful read

It might still be a positive number due to the call to sqfs_disk_read. This only happens when reading a file from an uncompressed squashfs.

I found this by trying to boot using the extlinux bootmethod, where positive values are treated as errors.

---

 fs/squashfs/sqfs.c | 2 ++
 1 file changed, 2 insertions(+)
fs/squashfs/sqfs.c +2 -0
index 543db8c7e9e..0768fc4a7b2 100644
@@ -1636,6 +1636,8 @@ static int sqfs_read_nest(const char *filename, void *buf, loff_t offset,
 		*actread = finfo.size;
 	}
 
+	ret = 0;
+
 out:
 	free(fragment);
 	free(datablock);
Signature · 4 lines
2.53.0

base-commit: e3405917a1806971d9e72a94186b299f05581e1a
branch: squashfs-fix
Acked-by on v1 1/1
#1 lore raw

Hi Michael,

Le 20/04/2026 à 18:35, Michael Zimmermann a écrit :

Quoted 7 lines

It might still be a positive number due to the call to sqfs_disk_read. This only happens when reading a file from an uncompressed squashfs.

I found this by trying to boot using the extlinux bootmethod, where positive values are treated as errors.

Good catch!

Quoted 10 lines

---

  fs/squashfs/sqfs.c | 2 ++
  1 file changed, 2 insertions(+)
fs/squashfs/sqfs.c +0 -0
index 543db8c7e9e..0768fc4a7b2 100644

fs/squashfs/sqfs.c static int sqfs_read_nest(const char *filename, void *buf, loff_t offset, · line 1643

Quoted 8 lines
fs/squashfs/sqfs.c +2 -0
@@ -1636,6 +1636,8 @@ static int sqfs_read_nest(const char *filename, void *buf, loff_t offset,
  		*actread = finfo.size;
  	}
 
+	ret = 0;
+
  out:
  	free(fragment);
  	free(datablock);

Thanks!

Regards,
Richard

Reviewed-by on v1 1/1
#2 lore raw
In reply to Michael Zimmermann
Quoted 5 lines · Michael Zimmermann

fs/squashfs: Set ret to 0 on successful read

It might still be a positive number due to the call to sqfs_disk_read. This only happens when reading a file from an uncompressed squashfs.

Quoted 7 lines

I found this by trying to boot using the extlinux bootmethod, where positive values are treated as errors.

fs/squashfs/sqfs.c | 2 ++

 1 file changed, 2 insertions(+)
#3 lore raw
In reply to Michael Zimmermann
Quoted 8 lines · Michael Zimmermann

It might still be a positive number due to the call to sqfs_disk_read. This only happens when reading a file from an uncompressed squashfs.

I found this by trying to boot using the extlinux bootmethod, where positive values are treated as errors.

[...]

Applied to u-boot/master, thanks!

[1/1] fs/squashfs: Set ret to 0 on successful read

      commit: 30885b01aaa4bcdfa3fee9ca3066d3af563e6688
Signature · 1 line
Tom