efivar/SOURCES/0009-Fix-another-error-of-Werror-address-of-packed-member.patch
2021-09-09 16:19:47 +00:00

55 lines
2.1 KiB
Diff

From d10381d23097d96afbb8d7c4199e58164da0d870 Mon Sep 17 00:00:00 2001
From: Chih-Wei Huang <cwhuang@linux.org.tw>
Date: Tue, 26 Feb 2019 18:42:20 +0800
Subject: [PATCH 09/63] Fix another error of -Werror=address-of-packed-member
Android 9 clang complains:
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]
(efi_guid_t *)&dp->infiniband.ioc_guid);
^~~~~~~~~~~~~~~~~~~~~~~
external/efivar/src/dp.h:76:19: note: expanded from macro 'format_guid'
memmove(&_guid, guid, sizeof(_guid)); \
^~~~
1 error generated.
Since commit c3c553d the fifth parameter of format_guid() is treated as
a const void *. The casting is unnecessary.
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
---
src/dp-media.c | 3 +--
src/dp-message.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/dp-media.c b/src/dp-media.c
index 96a576fdc2a..be691c44326 100644
--- a/src/dp-media.c
+++ b/src/dp-media.c
@@ -46,8 +46,7 @@ _format_media_dn(char *buf, size_t size, const_efidp dp)
break;
case EFIDP_HD_SIGNATURE_GUID:
format(buf, size, off, "HD", "GPT,");
- format_guid(buf, size, off, "HD",
- (efi_guid_t *)dp->hd.signature);
+ format_guid(buf, size, off, "HD", dp->hd.signature);
format(buf, size, off, "HD",
",0x%"PRIx64",0x%"PRIx64")",
dp->hd.start, dp->hd.size);
diff --git a/src/dp-message.c b/src/dp-message.c
index 9f964663de8..6b8e9072594 100644
--- a/src/dp-message.c
+++ b/src/dp-message.c
@@ -364,7 +364,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
dp->infiniband.port_gid[1],
dp->infiniband.port_gid[0]);
format_guid(buf, size, off, "Infiniband",
- (efi_guid_t *)&dp->infiniband.ioc_guid);
+ &dp->infiniband.ioc_guid);
format(buf, size, off, "Infiniband",
",%"PRIu64",%"PRIu64")",
dp->infiniband.target_port_id,
--
2.26.2