* [PATCH v2 2/2] perf/core: fix error handling in perf_event_alloc()
@ 2017-05-22 9:04 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-05-22 9:04 UTC (permalink / raw)
To: kernel-janitors
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.
Fixes: 375637bc5249 ("perf/core: Introduce address range filtering")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: split up the patch
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 13f5b942580b..4c24bc4c8a63 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9476,8 +9474,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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-05-22 9:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 9:04 [PATCH v2 2/2] perf/core: fix error handling in perf_event_alloc() Dan Carpenter
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).