Skip to contentSkip to conversation

erofs-utils: fix false-positive errors on gcc 4.8.5

PATCH New Gao Xiang 1 participant 1 message May 28, 2024 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: fix false-positive errors on gcc 4.8.5

Just old compiler bugs.

---
 lib/data.c      | 2 +-
 lib/dedupe.c    | 2 +-
 lib/fragments.c | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)
lib/data.c +1 -1
index a87053f..c139e0c 100644
@@ -420,7 +420,7 @@ static void *erofs_read_metadata_bdi(struct erofs_sb_info *sbi,
 	ret = blk_read(sbi, 0, data, erofs_blknr(sbi, *offset), 1);
 	if (ret)
 		return ERR_PTR(ret);
-	len = le16_to_cpu(*(__le16 *)&data[erofs_blkoff(sbi, *offset)]);
+	len = le16_to_cpu(*(__le16 *)(data + erofs_blkoff(sbi, *offset)));
 	if (!len)
 		return ERR_PTR(-EFSCORRUPTED);
 
lib/dedupe.c +1 -1
index aaaccb5..e475635 100644
@@ -99,7 +99,7 @@ int z_erofs_dedupe_match(struct z_erofs_dedupe_ctx *ctx)
 		struct z_erofs_dedupe_item *e;
 
 		unsigned int extra = 0;
-		u64 xxh64_csum;
+		u64 xxh64_csum = 0;
 
 		if (initial) {
 			/* initial try */
lib/fragments.c +2 -0
index d4f6be1..f4c9bd7 100644
@@ -289,6 +289,8 @@ int z_erofs_pack_file_from_fd(struct erofs_inode *inode, int fd,
 	if (memblock)
 		rc = z_erofs_fragments_dedupe_insert(memblock,
 			inode->fragment_size, inode->fragmentoff, tofcrc);
+	else
+		rc = 0;
 out:
 	if (memblock)
 		munmap(memblock, inode->i_size);
Signature · 1 line
2.39.3