From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: linux-kernel@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>
Subject: [PATCH] x86, relocs: avoid calling qsort() with NULL pointer
Date: Wed, 13 Nov 2013 14:43:50 +0100 [thread overview]
Message-ID: <20131113134350.GA277@x4> (raw)
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
reply other threads:[~2013-11-13 13:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131113134350.GA277@x4 \
--to=markus@trippelsdorf.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.