Skip to content

Commit 39a7661

Browse files
mikel-armbbgregkh
authored andcommitted
coresight: Fix uninitialised pointer bug in etm_setup_aux()
Commit [bb1860e] changed the sink handling code introducing an uninitialised pointer bug. This results in the default sink selection failing. Prior to commit: static void etm_setup_aux(...) <snip> struct coresight_device *sink; <snip> /* First get the selected sink from user space. */ if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); } else { sink = coresight_get_enabled_sink(true); } <ctd> *sink always initialised - possibly to NULL which triggers the automatic sink selection. After commit: static void etm_setup_aux(...) <snip> struct coresight_device *sink; <snip> /* First get the selected sink from user space. */ if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); } <ctd> *sink pointer uninitialised when not providing a sink on the perf command line. This breaks later checks to enable automatic sink selection. Fixes: bb1860e ("coresight: etm: perf: Sink selection using sysfs is deprecated") Signed-off-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20201029164559.1268531-3-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0f5cef2 commit 39a7661

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hwtracing/coresight/coresight-etm-perf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
210210
u32 id;
211211
int cpu = event->cpu;
212212
cpumask_t *mask;
213-
struct coresight_device *sink;
213+
struct coresight_device *sink = NULL;
214214
struct etm_event_data *event_data = NULL;
215215

216216
event_data = alloc_event_data(cpu);

0 commit comments

Comments
 (0)