From 64362b847c5a6486d80c76da6774cfed6ffdc614 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 8 Jan 2020 11:41:25 +0200 Subject: [PATCH] efivar: Pull patches from upstream to fix verbose issues in efibootmgr --- extra/efivar/build | 8 ++- extra/efivar/checksums | 7 ++- ...6d78a7fb5f6c5fb4a1d646040539db6cf865.patch | 51 +++++++++++++++++++ ...afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch | 28 ++++++++++ ...8921010d03f46704a476c69861515deb1ca.patch} | 0 ...3db85ff10890209d0fe48fb4856ad68e4e0.patch} | 0 ...03402fb32fa6d020bac57a40c7efe4aabb7d.patch | 31 +++++++++++ extra/efivar/sources | 7 ++- extra/efivar/version | 2 +- 9 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 extra/efivar/patches/0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch create mode 100644 extra/efivar/patches/4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch rename extra/efivar/patches/{fix-gcc9-dp.h.patch => b98ba8921010d03f46704a476c69861515deb1ca.patch} (100%) rename extra/efivar/patches/{fix-gcc9.patch => c3c553db85ff10890209d0fe48fb4856ad68e4e0.patch} (100%) create mode 100644 extra/efivar/patches/fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch diff --git a/extra/efivar/build b/extra/efivar/build index eb4038ac..47473ecc 100755 --- a/extra/efivar/build +++ b/extra/efivar/build @@ -1,7 +1,11 @@ #!/bin/sh -e -patch -p1 < fix-gcc9-dp.h.patch -patch -p1 < fix-gcc9.patch +# The order here matters. +patch -p1 < b98ba8921010d03f46704a476c69861515deb1ca.patch +patch -p1 < c3c553db85ff10890209d0fe48fb4856ad68e4e0.patch +patch -p1 < 0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch +patch -p1 < fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch +patch -p1 < 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch # Avoid repeating ourselves. mk() { diff --git a/extra/efivar/checksums b/extra/efivar/checksums index 119c5824..0445affa 100644 --- a/extra/efivar/checksums +++ b/extra/efivar/checksums @@ -1,3 +1,6 @@ 3c67feb93f901b98fbb897d5ca82931a6698b5bcd6ac34f0815f670d77747b9f efivar-37.tar.bz2 -475ca086eecabeaaff6111c3e6766f7e31d88a4fb6e0d082e34201e2cfaf295a fix-gcc9-dp.h.patch -7e72f92eb0d03558b9b14ede6a68e29c0051ffe745a8c7a84d06dce6af458351 fix-gcc9.patch +475ca086eecabeaaff6111c3e6766f7e31d88a4fb6e0d082e34201e2cfaf295a b98ba8921010d03f46704a476c69861515deb1ca.patch +7e72f92eb0d03558b9b14ede6a68e29c0051ffe745a8c7a84d06dce6af458351 c3c553db85ff10890209d0fe48fb4856ad68e4e0.patch +c3dcda97408b7d4957d440b1802081d1861a9923c7d4eb5ee6d3c9e31ae668fc 0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch +4d53ca9f09e3704aa0cc58f36cf475f9c0e54464305930d0ea9e26e7d0461ef6 fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch +bc552a018399fb9c976b0087f3407ec34004f8b64a5982af76556dcd790852aa 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch diff --git a/extra/efivar/patches/0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch b/extra/efivar/patches/0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch new file mode 100644 index 00000000..e4a43582 --- /dev/null +++ b/extra/efivar/patches/0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch @@ -0,0 +1,51 @@ +From 0dad6d78a7fb5f6c5fb4a1d646040539db6cf865 Mon Sep 17 00:00:00 2001 +From: Chih-Wei Huang +Date: Tue, 26 Feb 2019 18:42:20 +0800 +Subject: [PATCH] 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 +--- + 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 96a576f..be691c4 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 9f96466..6b8e907 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, diff --git a/extra/efivar/patches/4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch b/extra/efivar/patches/4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch new file mode 100644 index 00000000..176e3fd1 --- /dev/null +++ b/extra/efivar/patches/4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch @@ -0,0 +1,28 @@ +From 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 5 Mar 2019 17:23:32 +0100 +Subject: [PATCH] ucs2.h: fix logic that checks for UCS-2 string termination + +Currently the loop to count the lenght of the UCS-2 string ends if either +of the two bytes are 0, but 0 is a valid value for UCS-2 character codes. + +So only break the loop when 0 is the value for both UCS-2 char bytes. + +Signed-off-by: Javier Martinez Canillas +--- + src/ucs2.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ucs2.h b/src/ucs2.h +index e0390c3..fd8b056 100644 +--- a/src/ucs2.h ++++ b/src/ucs2.h +@@ -29,7 +29,7 @@ ucs2len(const void *vs, ssize_t limit) + const uint8_t *s8 = vs; + + for (i = 0; +- i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0; ++ i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0); + i++, s8 += 2) + ; + return i; diff --git a/extra/efivar/patches/fix-gcc9-dp.h.patch b/extra/efivar/patches/b98ba8921010d03f46704a476c69861515deb1ca.patch similarity index 100% rename from extra/efivar/patches/fix-gcc9-dp.h.patch rename to extra/efivar/patches/b98ba8921010d03f46704a476c69861515deb1ca.patch diff --git a/extra/efivar/patches/fix-gcc9.patch b/extra/efivar/patches/c3c553db85ff10890209d0fe48fb4856ad68e4e0.patch similarity index 100% rename from extra/efivar/patches/fix-gcc9.patch rename to extra/efivar/patches/c3c553db85ff10890209d0fe48fb4856ad68e4e0.patch diff --git a/extra/efivar/patches/fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch b/extra/efivar/patches/fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch new file mode 100644 index 00000000..513c0e73 --- /dev/null +++ b/extra/efivar/patches/fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch @@ -0,0 +1,31 @@ +From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 5 Mar 2019 17:23:24 +0100 +Subject: [PATCH] ucs2.h: remove unused variable + +The const uint16_t pointer is not used since now the two bytes of the +UCS-2 chars are checked to know if is the termination of the string. + +Signed-off-by: Javier Martinez Canillas +--- + src/ucs2.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/ucs2.h b/src/ucs2.h +index edd8367..e0390c3 100644 +--- a/src/ucs2.h ++++ b/src/ucs2.h +@@ -26,12 +26,11 @@ static inline size_t UNUSED + ucs2len(const void *vs, ssize_t limit) + { + ssize_t i; +- const uint16_t *s = vs; + const uint8_t *s8 = vs; + + for (i = 0; + i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0; +- i++, s8 += 2, s++) ++ i++, s8 += 2) + ; + return i; + } diff --git a/extra/efivar/sources b/extra/efivar/sources index 0f76dab3..8d21f40e 100644 --- a/extra/efivar/sources +++ b/extra/efivar/sources @@ -1,3 +1,6 @@ https://github.com/rhboot/efivar/releases/download/37/efivar-37.tar.bz2 -patches/fix-gcc9-dp.h.patch -patches/fix-gcc9.patch +patches/b98ba8921010d03f46704a476c69861515deb1ca.patch +patches/c3c553db85ff10890209d0fe48fb4856ad68e4e0.patch +patches/0dad6d78a7fb5f6c5fb4a1d646040539db6cf865.patch +patches/fdb803402fb32fa6d020bac57a40c7efe4aabb7d.patch +patches/4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e.patch diff --git a/extra/efivar/version b/extra/efivar/version index f1e16caf..de8594ab 100644 --- a/extra/efivar/version +++ b/extra/efivar/version @@ -1 +1 @@ -37 2 +37 3