mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for David Ahern <dsahern@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, anton@samba.org,
	hpa@zytor.com, mingo@redhat.com, dsahern@gmail.com,
	tglx@linutronix.de
Subject: [tip:perf/urgent] perf session: Fix crash with invalid CPU list
Date: Mon, 5 Dec 2011 04:35:45 -0800	[thread overview]
Message-ID: <tip-47fbe53bef3b219a365ebf3eca949d6cd4c5291c@git.kernel.org> (raw)
In-Reply-To: <1321206327-5881-1-git-send-email-dsahern@gmail.com>

Commit-ID:  47fbe53bef3b219a365ebf3eca949d6cd4c5291c
Gitweb:     http://git.kernel.org/tip/47fbe53bef3b219a365ebf3eca949d6cd4c5291c
Author:     David Ahern <dsahern@gmail.com>
AuthorDate: Sun, 13 Nov 2011 10:45:27 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 16 Nov 2011 10:02:26 -0200

perf session: Fix crash with invalid CPU list

commit 5d67be9 added the option to specify a range of CPUs of interest,
but does not catch an invalid CPU list:

$ perf script -c foo
Segmentation fault (core dumped)

Cc: Anton Blanchard <anton@samba.org>
Link: http://lkml.kernel.org/r/1321206327-5881-1-git-send-email-dsahern@gmail.com
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 85c1e6b7..0f4555c 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session,
 	}
 
 	map = cpu_map__new(cpu_list);
+	if (map == NULL) {
+		pr_err("Invalid cpu_list\n");
+		return -1;
+	}
 
 	for (i = 0; i < map->nr; i++) {
 		int cpu = map->map[i];

      reply	other threads:[~2011-12-05 12:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 17:45 [PATCH] perf tools: fix " David Ahern
2011-12-05 12:35 ` tip-bot for David Ahern [this message]

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-47fbe53bef3b219a365ebf3eca949d6cd4c5291c@git.kernel.org \
    --to=dsahern@gmail.com \
    --cc=acme@redhat.com \
    --cc=anton@samba.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome