From f8779edfd9ee3f87f515a846b020c11b984e68f3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Jun 2020 11:41:56 -0600 Subject: [PATCH] oslib/linux-blkzoned: fix bogus poiter alignment warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit GCC 10.x reports: oslib/linux-blkzoned.c: In function ‘blkzoned_report_zones’: oslib/linux-blkzoned.c:146:18: warning: taking address of packed member of ‘struct blk_zone_report’ may result in an unaligned pointer value [-Waddress-of-packed-member] 146 | blkz = (void *) &hdr->zones[0]; which is totally fine, but we can easily avoid this warning by just setting the 'blkz' pointer to the end of 'hdr'. Signed-off-by: Jens Axboe --- oslib/linux-blkzoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c index 61ea3a53..1cf06363 100644 --- a/oslib/linux-blkzoned.c +++ b/oslib/linux-blkzoned.c @@ -143,7 +143,7 @@ int blkzoned_report_zones(struct thread_data *td, struct fio_file *f, } nr_zones = hdr->nr_zones; - blkz = &hdr->zones[0]; + blkz = (void *) hdr + sizeof(*hdr); z = &zones[0]; for (i = 0; i < nr_zones; i++, z++, blkz++) { z->start = blkz->start << 9; -- 2.25.1