1 From 0dad6d78a7fb5f6c5fb4a1d646040539db6cf865 Mon Sep 17 00:00:00 2001
2 From: Chih-Wei Huang <cwhuang@linux.org.tw>
3 Date: Tue, 26 Feb 2019 18:42:20 +0800
4 Subject: [PATCH] Fix another error of -Werror=address-of-packed-member
6 Android 9 clang complains:
8 external/efivar/src/dp-message.c:367:24: error: taking address of packed member '' of class or structure 'efidp_infiniband' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
9 (efi_guid_t *)&dp->infiniband.ioc_guid);
10 ^~~~~~~~~~~~~~~~~~~~~~~
11 external/efivar/src/dp.h:76:19: note: expanded from macro 'format_guid'
12 memmove(&_guid, guid, sizeof(_guid)); \
16 Since commit c3c553d the fifth parameter of format_guid() is treated as
17 a const void *. The casting is unnecessary.
19 Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
21 src/dp-media.c | 3 +--
22 src/dp-message.c | 2 +-
23 2 files changed, 2 insertions(+), 3 deletions(-)
25 diff --git a/src/dp-media.c b/src/dp-media.c
26 index 96a576f..be691c4 100644
29 @@ -46,8 +46,7 @@ _format_media_dn(char *buf, size_t size, const_efidp dp)
31 case EFIDP_HD_SIGNATURE_GUID:
32 format(buf, size, off, "HD", "GPT,");
33 - format_guid(buf, size, off, "HD",
34 - (efi_guid_t *)dp->hd.signature);
35 + format_guid(buf, size, off, "HD", dp->hd.signature);
36 format(buf, size, off, "HD",
37 ",0x%"PRIx64",0x%"PRIx64")",
38 dp->hd.start, dp->hd.size);
39 diff --git a/src/dp-message.c b/src/dp-message.c
40 index 9f96466..6b8e907 100644
41 --- a/src/dp-message.c
42 +++ b/src/dp-message.c
43 @@ -364,7 +364,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
44 dp->infiniband.port_gid[1],
45 dp->infiniband.port_gid[0]);
46 format_guid(buf, size, off, "Infiniband",
47 - (efi_guid_t *)&dp->infiniband.ioc_guid);
48 + &dp->infiniband.ioc_guid);
49 format(buf, size, off, "Infiniband",
50 ",%"PRIu64",%"PRIu64")",
51 dp->infiniband.target_port_id,