From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: linux-sparse@vger.kernel.org
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Pekka Enberg" <penberg@kernel.org>,
"Christopher Li" <sparse@chrisli.org>,
"Jeff Garzik" <jgarzik@redhat.com>,
"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: [PATCH 2/2] sparse, llvm: don't compile erroneous code
Date: Tue, 9 Oct 2012 01:17:58 +0200 [thread overview]
Message-ID: <1349738279-13253-2-git-send-email-j.neuschaefer@gmx.net> (raw)
In-Reply-To: <1349738279-13253-1-git-send-email-j.neuschaefer@gmx.net>
If sparse emits an error message while parsing a file, don't
generate LLVM code, and also don't parse further files. This
prevents a segfault when sparse-llvm is fed with certain junk.
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
sparse-llvm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sparse-llvm.c b/sparse-llvm.c
index e4929e9..0fc0dae 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -1268,7 +1268,10 @@ int main(int argc, char **argv)
compile(module, sparse_initialize(argc, argv, &filelist));
FOR_EACH_PTR_NOTAG(filelist, file) {
- compile(module, sparse(file));
+ struct symbol_list *symlist = sparse(file);
+ if (error_happened)
+ break;
+ compile(module, symlist);
} END_FOR_EACH_PTR_NOTAG(file);
LLVMVerifyModule(module, LLVMPrintMessageAction, NULL);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-10-08 23:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 23:17 [PATCH 1/2] lib: rename die_if_error to error_happened Jonathan Neuschäfer
2012-10-08 23:17 ` Jonathan Neuschäfer [this message]
2012-10-09 6:30 ` [PATCH 2/2] sparse, llvm: don't compile erroneous code Pekka Enberg
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=1349738279-13253-2-git-send-email-j.neuschaefer@gmx.net \
--to=j.neuschaefer@gmx.net \
--cc=jgarzik@redhat.com \
--cc=linux-sparse@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=sparse@chrisli.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).