From 02af069d480bb75dd134518359b70e66d3dc5950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 30 Nov 2022 20:03:11 +0100 Subject: [PATCH] boot_defs.h: Fix compile warning in zfcpdump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The struct scsi_dump_sb is defined with the __packed attribute and produces the following compile warning in zfcpdump: zfcpdump_part.c: In function ‘csum_update’: zfcpdump_part.c:125:41: warning: taking address of packed member of ‘struct scsi_dump_sb’ may result in an unaligned pointer value [-Waddress-of-packed-member] 125 | dump_sb.csum_size, &dump_sb.csum)) { | ^~~~~~~~~~~~~ However, all members are of the same size and the __packed attribute is unnecessary. Remove the attribute to get rid of the warning. Add assertion to ensure correct size of the struct during compile time. Reviewed-by: Steffen Eiden Signed-off-by: Jan Höppner Signed-off-by: Steffen Eiden --- include/boot/boot_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boot/boot_defs.h b/include/boot/boot_defs.h index 41ab4b09..bb7857e3 100644 --- a/include/boot/boot_defs.h +++ b/include/boot/boot_defs.h @@ -159,7 +159,8 @@ struct scsi_dump_sb { uint64_t csum_offset; uint64_t csum_size; uint64_t csum; -} __packed; +}; +STATIC_ASSERT(sizeof(struct scsi_dump_sb) == 72); #define SCSI_DUMP_SB_MAGIC 0x5a46435044554d50ULL /* ZFCPDUMP */ /* To avoid a csum entry of 0 a seed is used */