From: Karel Zak Date: Tue, 17 Feb 2026 10:20:38 +0000 (+0100) Subject: libblkid: (btrfs) use BTRFS_NR_SB_LOG_ZONES and rep->zones X-Git-Tag: v2.43-devel~67^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8264aabcdc13d8ac2eb07c260d80ad1f44a081e5;p=thirdparty%2Futil-linux.git libblkid: (btrfs) use BTRFS_NR_SB_LOG_ZONES and rep->zones Use the BTRFS_NR_SB_LOG_ZONES constant instead of a hardcoded 2 when calling blkdev_get_zonereport() to be consistent with the rest of the function that already uses this constant. Replace the pointer arithmetic (struct blk_zone *)(rep + 1) with the more readable rep->zones flexible array member access. Addresses: https://github.com/util-linux/util-linux/pull/3995 Signed-off-by: Karel Zak --- diff --git a/libblkid/src/superblocks/btrfs.c b/libblkid/src/superblocks/btrfs.c index 114d348ab..11434b210 100644 --- a/libblkid/src/superblocks/btrfs.c +++ b/libblkid/src/superblocks/btrfs.c @@ -179,12 +179,12 @@ static int sb_log_offset(blkid_probe pr, uint64_t *bytenr_ret) zone_size_sector = pr->zone_size >> SECTOR_SHIFT; - rep = blkdev_get_zonereport(pr->fd, zone_num * zone_size_sector, 2); + rep = blkdev_get_zonereport(pr->fd, zone_num * zone_size_sector, BTRFS_NR_SB_LOG_ZONES); if (!rep) { ret = -errno; goto out; } - zones = (struct blk_zone *)(rep + 1); + zones = rep->zones; /* * Use the head of the first conventional zone, if the zones