All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v
@ 2021-03-17 20:43 Peter Korsgaard
  2021-03-18 17:34 ` Ryan Barnett
  2021-03-20 21:19 ` Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Korsgaard @ 2021-03-17 20:43 UTC (permalink / raw)
  To: buildroot

Without this patch, efibootmgr -v errors out:

efibootmgr -v
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001,0002,0000
Boot0000* Diagnostic ProgramCould not parse device path: Invalid argument

vs:

efibootmgr -v
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001,0002,0000
Boot0000* Diagnostic Program    FvVol(5c60f367-a505-419a-859e-2a4ff6ca6fe5)/FvFile(085e8cc2-8ec9-4666-bd2a-49d481e95fa7)
Boot0001* containeros-a HD(1,GPT,1491d519-d9d7-7c4e-9110-4ab21271ac64,0x800,0x20000)/File(\efi\container\boot.efi)

For more details, see:

https://github.com/rhboot/efibootmgr/issues/133
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963475

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 .../0005-ucs2.h-remove-unused-variable.patch  | 35 +++++++++++++++++++
 ...-that-checks-for-UCS-2-string-termin.patch | 32 +++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 package/efivar/0005-ucs2.h-remove-unused-variable.patch
 create mode 100644 package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch

diff --git a/package/efivar/0005-ucs2.h-remove-unused-variable.patch b/package/efivar/0005-ucs2.h-remove-unused-variable.patch
new file mode 100644
index 0000000000..a814043ce8
--- /dev/null
+++ b/package/efivar/0005-ucs2.h-remove-unused-variable.patch
@@ -0,0 +1,35 @@
+From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javierm@redhat.com>
+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 <javierm@redhat.com>
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+ 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;
+ }
+-- 
+2.20.1
+
diff --git a/package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch b/package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch
new file mode 100644
index 0000000000..00b20332ef
--- /dev/null
+++ b/package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch
@@ -0,0 +1,32 @@
+From 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javierm@redhat.com>
+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 <javierm@redhat.com>
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+ 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;
+-- 
+2.20.1
+
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v
  2021-03-17 20:43 [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v Peter Korsgaard
@ 2021-03-18 17:34 ` Ryan Barnett
  2021-03-18 20:11   ` Peter Korsgaard
  2021-03-20 21:19 ` Thomas Petazzoni
  1 sibling, 1 reply; 4+ messages in thread
From: Ryan Barnett @ 2021-03-18 17:34 UTC (permalink / raw)
  To: buildroot

On Wed, Mar 17, 2021 at 3:45 PM Peter Korsgaard <peter@korsgaard.com> wrote:
>
> Without this patch, efibootmgr -v errors out:
>
> efibootmgr -v
> BootCurrent: 0001
> Timeout: 1 seconds
> BootOrder: 0001,0002,0000
> Boot0000* Diagnostic ProgramCould not parse device path: Invalid argument
>
> vs:
>
> efibootmgr -v
> BootCurrent: 0001
> Timeout: 1 seconds
> BootOrder: 0001,0002,0000
> Boot0000* Diagnostic Program    FvVol(5c60f367-a505-419a-859e-2a4ff6ca6fe5)/FvFile(085e8cc2-8ec9-4666-bd2a-49d481e95fa7)
> Boot0001* containeros-a HD(1,GPT,1491d519-d9d7-7c4e-9110-4ab21271ac64,0x800,0x20000)/File(\efi\container\boot.efi)
>
> For more details, see:
>
> https://github.com/rhboot/efibootmgr/issues/133
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963475
>
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
>  .../0005-ucs2.h-remove-unused-variable.patch  | 35 +++++++++++++++++++
>  ...-that-checks-for-UCS-2-string-termin.patch | 32 +++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 package/efivar/0005-ucs2.h-remove-unused-variable.patch
>  create mode 100644 package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch
>
> diff --git a/package/efivar/0005-ucs2.h-remove-unused-variable.patch b/package/efivar/0005-ucs2.h-remove-unused-variable.patch
> new file mode 100644
> index 0000000000..a814043ce8
> --- /dev/null
> +++ b/package/efivar/0005-ucs2.h-remove-unused-variable.patch
> @@ -0,0 +1,35 @@
> +From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001
> +From: Javier Martinez Canillas <javierm@redhat.com>
> +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.
> +

Should 'Backported from: fdb803402fb32fa6d020bac57a40c7efe4aabb7d' be
added here since the patches could be regenerated and the original
commit sha1 could be lost?

https://buildroot.org/downloads/manual/manual.html#_integrating_patches_found_on_the_web

> +Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> +Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> +---
> + 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;
> + }
> +--
> +2.20.1
> +
> diff --git a/package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch b/package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch
> new file mode 100644
> index 0000000000..00b20332ef
> --- /dev/null
> +++ b/package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch
> @@ -0,0 +1,32 @@
> +From 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e Mon Sep 17 00:00:00 2001
> +From: Javier Martinez Canillas <javierm@redhat.com>
> +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.
> +

Same about adding 'backported from' as above.

> +Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> +Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> +---
> + 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;
> +--
> +2.20.1
> +

Reviewed-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>

Thanks,
-Ryan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v
  2021-03-18 17:34 ` Ryan Barnett
@ 2021-03-18 20:11   ` Peter Korsgaard
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2021-03-18 20:11 UTC (permalink / raw)
  To: buildroot

>>>>> "Ryan" == Ryan Barnett <ryan.barnett@collins.com> writes:

 > On Wed, Mar 17, 2021 at 3:45 PM Peter Korsgaard <peter@korsgaard.com> wrote:

..
 >> 
 >> +From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001
 >> +From: Javier Martinez Canillas <javierm@redhat.com>
 >> +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.
 >> +

 > Should 'Backported from: fdb803402fb32fa6d020bac57a40c7efe4aabb7d' be
 > added here since the patches could be regenerated and the original
 > commit sha1 could be lost?

 > https://buildroot.org/downloads/manual/manual.html#_integrating_patches_found_on_the_web

Given that these are upstream patches, I don't see why they would ever
need to be rebased and regenerated?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v
  2021-03-17 20:43 [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v Peter Korsgaard
  2021-03-18 17:34 ` Ryan Barnett
@ 2021-03-20 21:19 ` Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2021-03-20 21:19 UTC (permalink / raw)
  To: buildroot

On Wed, 17 Mar 2021 21:43:34 +0100
Peter Korsgaard <peter@korsgaard.com> wrote:

> Without this patch, efibootmgr -v errors out:
> 
> efibootmgr -v
> BootCurrent: 0001
> Timeout: 1 seconds
> BootOrder: 0001,0002,0000
> Boot0000* Diagnostic ProgramCould not parse device path: Invalid argument
> 
> vs:
> 
> efibootmgr -v
> BootCurrent: 0001
> Timeout: 1 seconds
> BootOrder: 0001,0002,0000
> Boot0000* Diagnostic Program    FvVol(5c60f367-a505-419a-859e-2a4ff6ca6fe5)/FvFile(085e8cc2-8ec9-4666-bd2a-49d481e95fa7)
> Boot0001* containeros-a HD(1,GPT,1491d519-d9d7-7c4e-9110-4ab21271ac64,0x800,0x20000)/File(\efi\container\boot.efi)
> 
> For more details, see:
> 
> https://github.com/rhboot/efibootmgr/issues/133
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963475
> 
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
>  .../0005-ucs2.h-remove-unused-variable.patch  | 35 +++++++++++++++++++
>  ...-that-checks-for-UCS-2-string-termin.patch | 32 +++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 package/efivar/0005-ucs2.h-remove-unused-variable.patch
>  create mode 100644 package/efivar/0006-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-20 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 20:43 [Buildroot] [PATCH] package/efivar: add upstream post-37 patches fixing efibootmgr -v Peter Korsgaard
2021-03-18 17:34 ` Ryan Barnett
2021-03-18 20:11   ` Peter Korsgaard
2021-03-20 21:19 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.