提交 39a7661d 编写于 作者: M Mike Leach 提交者: Greg Kroah-Hartman

coresight: Fix uninitialised pointer bug in etm_setup_aux()

Commit [bb1860ef] 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: bb1860ef ("coresight: etm: perf: Sink selection using sysfs is deprecated")
Signed-off-by: NMike Leach <mike.leach@linaro.org>
Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20201029164559.1268531-3-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0f5cef2b
...@@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, ...@@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
u32 id; u32 id;
int cpu = event->cpu; int cpu = event->cpu;
cpumask_t *mask; cpumask_t *mask;
struct coresight_device *sink; struct coresight_device *sink = NULL;
struct etm_event_data *event_data = NULL; struct etm_event_data *event_data = NULL;
event_data = alloc_event_data(cpu); event_data = alloc_event_data(cpu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册