Fixes the following warning: dasd.c: In function ‘read_dasd_pt’: dasd.c:206:3: warning: converting a packed ‘volume_label_t’ {aka ‘struct volume_label’} pointer (alignment 1) to a ‘label_ints_t’ {aka ‘unsigned int’} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member] 206 | label_ints_t *label = (label_ints_t *) &vlabel; | ^~~~~~~~~~~~ As volume_label_t is only used in read_dasd_pt(), and filled with memcpy(), increasing its alignment should be safe. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- kpartx/dasd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpartx/dasd.h b/kpartx/dasd.h index 749af49a..8ad5d620 100644 --- a/kpartx/dasd.h +++ b/kpartx/dasd.h @@ -68,7 +68,7 @@ typedef struct volume_label char res3[28]; /* reserved */ uint8_t ldl_version; /* version number, valid for ldl format */ uint64_t formatted_blocks; /* valid when ldl_version >= f2 */ -} __attribute__ ((packed)) volume_label_t; +} __attribute__ ((packed, aligned(__alignof__(int)))) volume_label_t; typedef struct extent -- 2.21.0 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel