aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Kenny <darren.kenny@oracle.com>2022-03-16 17:25:04 +0000
committerDaniel Kiper <daniel.kiper@oracle.com>2022-03-21 19:34:08 +0100
commit8541f319cb840abae054f78757aeddb41b4711a6 (patch)
tree1d5501541e96fe79aa095a0dfdf9e851552833fc
parentcd63a2f8cd2c14748f4374abcd9a38705f2e7055 (diff)
downloadgrub-8541f319cb840abae054f78757aeddb41b4711a6.tar.gz
grub-mkimage: Only check aarch64 relocations when built for aarch64
Coverity flagged the switch checks for R_AARCH64_* as being logically dead code, since it could never happen on x86 due to the masking of the values earlier in the code. A check for building on __arm__ (which gcc and clang define) and for MKIMAGE_ELF64 (which GRUB defines) has been added to avoid this dead code being built in. Fixes: CID 158599 Signed-off-by: Darren Kenny <darren.kenny@oracle.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
-rw-r--r--util/grub-mkimagexx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index 9762bc80e..1e29e255e 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -1631,6 +1631,7 @@ translate_relocation_pe (struct translate_context *ctx,
}
break;
case EM_AARCH64:
+#if defined(MKIMAGE_ELF64) && defined(__arm__)
switch (ELF_R_TYPE (info))
{
case R_AARCH64_ABS64:
@@ -1666,6 +1667,7 @@ translate_relocation_pe (struct translate_context *ctx,
(unsigned int) ELF_R_TYPE (info));
break;
}
+#endif /* defined(MKIMAGE_ELF64) && define(__arm__) */
break;
break;
#if defined(MKIMAGE_ELF32)