]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: erofs: calculate checksum with offset
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 17 Apr 2023 09:36:30 +0000 (11:36 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 17 Apr 2023 09:36:55 +0000 (11:36 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libblkid/src/superblocks/erofs.c

index c451083c0262a9fc3db38972a0d288192d67bbe3..14d272efef633d5035d281f0d1392d5b4c234b3e 100644 (file)
@@ -58,8 +58,9 @@ static int erofs_verify_checksum(blkid_probe pr, const struct blkid_idmag *mag,
        if (!csummed)
                return 0;
 
-       memset(csummed + offsetof(struct erofs_super_block, checksum), 0, sizeof(uint32_t));
-       csum = crc32c(~0L, csummed, csummed_size);
+       csum = ul_crc32c_exclude_offset(~0L, csummed, csummed_size,
+                                       offsetof(struct erofs_super_block, checksum),
+                                       sizeof_member(struct erofs_super_block, checksum));
 
        return blkid_probe_verify_csum(pr, csum, expected);
 }