From: tip-bot for Patrick Palka <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
mingo@redhat.com, hpa@zytor.com, mingo@kernel.org,
a.p.zijlstra@chello.nl, patrick@parcs.ath.cx, tglx@linutronix.de
Subject: [tip:perf/urgent] perf bench: Fix NULL pointer dereference in " perf bench all"
Date: Tue, 18 Mar 2014 01:29:28 -0700 [thread overview]
Message-ID: <tip-6eeefccdcfc2cc9697562e740bfe6c35fddd4e1c@git.kernel.org> (raw)
In-Reply-To: <1394664051-6037-1-git-send-email-patrick@parcs.ath.cx>
Commit-ID: 6eeefccdcfc2cc9697562e740bfe6c35fddd4e1c
Gitweb: http://git.kernel.org/tip/6eeefccdcfc2cc9697562e740bfe6c35fddd4e1c
Author: Patrick Palka <patrick@parcs.ath.cx>
AuthorDate: Wed, 12 Mar 2014 18:40:51 -0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 14 Mar 2014 13:45:54 -0300
perf bench: Fix NULL pointer dereference in "perf bench all"
The for_each_bench() macro must check that the "benchmarks" field of a
collection is not NULL before dereferencing it because the "all"
collection in particular has a NULL "benchmarks" field (signifying that
it has no benchmarks to iterate over).
This fixes this NULL pointer dereference when running "perf bench all":
[root@ssdandy ~]# perf bench all
<SNIP>
# Running mem/memset benchmark...
# Copying 1MB Bytes ...
2.453675 GB/Sec
12.056327 GB/Sec (with prefault)
Segmentation fault (core dumped)
[root@ssdandy ~]#
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1394664051-6037-1-git-send-email-patrick@parcs.ath.cx
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-bench.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index e47f90c..8a987d2 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -76,7 +76,7 @@ static struct collection collections[] = {
/* Iterate over all benchmarks within a collection: */
#define for_each_bench(coll, bench) \
- for (bench = coll->benchmarks; bench->name; bench++)
+ for (bench = coll->benchmarks; bench && bench->name; bench++)
static void dump_benchmarks(struct collection *coll)
{
prev parent reply other threads:[~2014-03-18 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 22:40 [PATCH] perf bench: Fix NULL pointer dereference in "perf " Patrick Palka
2014-03-13 14:34 ` Arnaldo Carvalho de Melo
2014-03-13 14:47 ` Patrick Palka
2014-03-13 18:18 ` Arnaldo Carvalho de Melo
2014-03-18 8:29 ` tip-bot for Patrick Palka [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-6eeefccdcfc2cc9697562e740bfe6c35fddd4e1c@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=patrick@parcs.ath.cx \
--cc=paulus@samba.org \
--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