[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20131113134350.GA277@x4>
Date: Wed, 13 Nov 2013 14:43:50 +0100
From: Markus Trippelsdorf <markus@...ppelsdorf.de>
To: linux-kernel@...r.kernel.org
Cc: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>
Subject: [PATCH] x86, relocs: avoid calling qsort() with NULL pointer
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@...ppelsdorf.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists