public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Simon Ser <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, tglx@linutronix.de, jpoimboe@redhat.com,
	contact@emersion.fr, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, peterz@infradead.org,
	hpa@zytor.com
Subject: [tip:core/urgent] objtool: Fix seg fault caused by missing parameter
Date: Sat, 30 Dec 2017 13:07:15 -0800	[thread overview]
Message-ID: <tip-d89e426499cf36b96161bd32970d6783f1fbcb0e@git.kernel.org> (raw)
In-Reply-To: <9172803ec7ebb72535bcd0b7f966ae96d515968e.1514666459.git.jpoimboe@redhat.com>

Commit-ID:  d89e426499cf36b96161bd32970d6783f1fbcb0e
Gitweb:     https://git.kernel.org/tip/d89e426499cf36b96161bd32970d6783f1fbcb0e
Author:     Simon Ser <contact@emersion.fr>
AuthorDate: Sat, 30 Dec 2017 14:43:31 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 30 Dec 2017 22:04:17 +0100

objtool: Fix seg fault caused by missing parameter

Fix a seg fault when no parameter is provided to 'objtool orc'.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/9172803ec7ebb72535bcd0b7f966ae96d515968e.1514666459.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 tools/objtool/builtin-orc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-orc.c b/tools/objtool/builtin-orc.c
index 4c6b5c9..91e8e19 100644
--- a/tools/objtool/builtin-orc.c
+++ b/tools/objtool/builtin-orc.c
@@ -44,6 +44,9 @@ int cmd_orc(int argc, const char **argv)
 	const char *objname;
 
 	argc--; argv++;
+	if (argc <= 0)
+		usage_with_options(orc_usage, check_options);
+
 	if (!strncmp(argv[0], "gen", 3)) {
 		argc = parse_options(argc, argv, check_options, orc_usage, 0);
 		if (argc != 1)
@@ -52,7 +55,6 @@ int cmd_orc(int argc, const char **argv)
 		objname = argv[0];
 
 		return check(objname, no_fp, no_unreachable, true);
-
 	}
 
 	if (!strcmp(argv[0], "dump")) {

  reply	other threads:[~2017-12-30 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-30 20:43 [PATCH 0/2] objtool: two seg fault fixes Josh Poimboeuf
2017-12-30 20:43 ` [PATCH 1/2] objtool: Fix seg fault caused by missing parameter Josh Poimboeuf
2017-12-30 21:07   ` tip-bot for Simon Ser [this message]
2017-12-30 20:43 ` [PATCH 2/2] objtool: Fix seg fault with clang-compiled objects Josh Poimboeuf
2017-12-30 21:07   ` [tip:core/urgent] " tip-bot for Simon Ser

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=tip-d89e426499cf36b96161bd32970d6783f1fbcb0e@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=contact@emersion.fr \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --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