From: tip-bot for Dan Carpenter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, acme@kernel.org, mingo@kernel.org,
dan.carpenter@oracle.com, jolsa@redhat.com, peterz@infradead.org,
hpa@zytor.com, torvalds@linux-foundation.org,
vincent.weaver@maine.edu, tglx@linutronix.de,
alexander.shishkin@linux.intel.com, eranian@google.com,
linux-kernel@vger.kernel.org
Subject: [tip:perf/core] perf/core: Fix error handling in perf_event_alloc()
Date: Tue, 23 May 2017 01:41:58 -0700 [thread overview]
Message-ID: <tip-36cc2b9222b5106de34085c4dd8635ac67ef5cba@git.kernel.org> (raw)
In-Reply-To: <20170522090418.hvs6icgpdo53wkn5@mwanda>
Commit-ID: 36cc2b9222b5106de34085c4dd8635ac67ef5cba
Gitweb: http://git.kernel.org/tip/36cc2b9222b5106de34085c4dd8635ac67ef5cba
Author: Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Mon, 22 May 2017 12:04:18 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 23 May 2017 09:50:05 +0200
perf/core: Fix error handling in perf_event_alloc()
We don't set an error code here which means that perf_event_alloc()
returns ERR_PTR(0) (in other words NULL). The callers are not expecting
that and would Oops.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 375637bc5249 ("perf/core: Introduce address range filtering")
Link: http://lkml.kernel.org/r/20170522090418.hvs6icgpdo53wkn5@mwanda
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/events/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0028efa..f8c27d3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9469,8 +9469,10 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
event->addr_filters_offs = kcalloc(pmu->nr_addr_filters,
sizeof(unsigned long),
GFP_KERNEL);
- if (!event->addr_filters_offs)
+ if (!event->addr_filters_offs) {
+ err = -ENOMEM;
goto err_per_task;
+ }
/* force hw sync on the address filters */
event->addr_filters_gen = 1;
parent reply other threads:[~2017-05-23 8:46 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20170522090418.hvs6icgpdo53wkn5@mwanda>]
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-36cc2b9222b5106de34085c4dd8635ac67ef5cba@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dan.carpenter@oracle.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@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 \
--cc=vincent.weaver@maine.edu \
/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