* [PATCH] x86, relocs: avoid calling qsort() with NULL pointer
@ 2013-11-13 13:43 Markus Trippelsdorf
0 siblings, 0 replies; only message in thread
From: Markus Trippelsdorf @ 2013-11-13 13:43 UTC (permalink / raw)
To: linux-kernel; +Cc: H. Peter Anvin, Ingo Molnar
Current gcc trunk inserts a trap into arch/x86/tools/relocs:
% arch/x86/tools/relocs --realmode arch/x86/realmode/rm/realmode.elf
[1] 31456 illegal hardware instruction arch/x86/tools/relocs --realmode arch/x86/realmode/rm/realmode.elf
This happens because in the case of ELF_BITS==32 qsort is called with a
NULL pointer.
Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index f7bab68a4b83..592abb938de7 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -976,7 +976,8 @@ static void emit_relocs(int as_text, int use_real_mode)
/* Order the relocations for more efficient processing */
sort_relocs(&relocs16);
sort_relocs(&relocs32);
- sort_relocs(&relocs64);
+ if (ELF_BITS == 64)
+ sort_relocs(&relocs64);
/* Print the relocations */
if (as_text) {
--
Markus
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-13 13:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 13:43 [PATCH] x86, relocs: avoid calling qsort() with NULL pointer Markus Trippelsdorf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox