public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/GenFw: Fix casting result of comparison
@ 2021-03-26  0:48 Tim Crawford
  2021-03-29  5:11 ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Crawford @ 2021-03-26  0:48 UTC (permalink / raw)
  To: devel

The cast in IsDataShdr() is only applied the left side, causing it to
always return FALSE.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3271
Signed-off-by: Tim Crawford <tcrawford@system76.com>
---
 BaseTools/Source/C/GenFw/Elf32Convert.c | 2 +-
 BaseTools/Source/C/GenFw/Elf64Convert.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 7f351287a9..df54991768 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -262,7 +262,7 @@ IsDataShdr (
   if (IsHiiRsrcShdr(Shdr)) {
     return FALSE;
   }
-  return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
+  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE));
 }
 
 STATIC
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 4ed6b4477e..1bf1e9accb 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -270,7 +270,7 @@ IsDataShdr (
   if (IsHiiRsrcShdr(Shdr)) {
     return FALSE;
   }
-  return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
+  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE));
 }
 
 STATIC
-- 
2.30.2


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

end of thread, other threads:[~2021-03-29 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-26  0:48 [PATCH] BaseTools/GenFw: Fix casting result of comparison Tim Crawford
2021-03-29  5:11 ` 回复: [edk2-devel] " gaoliming
2021-03-29 13:12   ` Tim Crawford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox