From: Thomas Weißschuh Date: Wed, 25 Jan 2023 04:27:20 +0000 (+0000) Subject: libblkid: bcachefs: use uint64_t for structure length X-Git-Tag: v2.39-rc1~109 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df6e200fd6a3725e7bd00e6a6af6a7656fffae6a;p=thirdparty%2Futil-linux.git libblkid: bcachefs: use uint64_t for structure length The value of "u64s" can overflow when multiplied by 8. Use a larger type to avoid this. Signed-off-by: Thomas Weißschuh --- diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c index b66ed8b196..aba636a361 100644 --- a/libblkid/src/superblocks/bcache.c +++ b/libblkid/src/superblocks/bcache.c @@ -113,7 +113,7 @@ struct bcachefs_super_block { /* tag value for members field */ #define BCACHEFS_SB_FIELD_TYPE_MEMBERS 1 -#define BYTES(f) ((le32_to_cpu((f)->u64s) * 8)) +#define BYTES(f) ((((uint64_t) le32_to_cpu((f)->u64s)) * 8)) static int bcache_verify_checksum(blkid_probe pr, const struct blkid_idmag *mag, const struct bcache_super_block *bcs) @@ -246,8 +246,7 @@ static int probe_bcachefs(blkid_probe pr, const struct blkid_idmag *mag) { struct bcachefs_super_block *bcs; unsigned char *sb, *sb_end; - unsigned long sb_size; - uint64_t blocksize; + uint64_t sb_size, blocksize; bcs = blkid_probe_get_sb(pr, mag, struct bcachefs_super_block); if (!bcs)