erofs-utils: fix false-positive errors on gcc 4.8.5
authorGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 28 May 2024 06:43:13 +0000 (14:43 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 4 Jun 2024 09:00:22 +0000 (17:00 +0800)
Just old compiler bugs.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240528064313.1352565-1-hsiangkao@linux.alibaba.com
lib/data.c
lib/dedupe.c
lib/fragments.c

index a87053f63103ce2d032689daca8d1bdb1e6db32c..c139e0cc6ef43b316f068d9e013705e4a3bc7332 100644 (file)
@@ -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);
 
index ed20e7b3ebcad75b8a4eb90113a23a679fb9902e..665915a135f178c48bda267ac9a261a36747e486 100644 (file)
@@ -100,7 +100,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;
                u8 sha256[32];
 
                if (initial) {
index d4f6be191b74b6cc498ed16d6a6b2ce9b8468570..f4c9bd7eb05dd08e4ef73f0299210871b15e19c4 100644 (file)
@@ -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);