Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

coresight: add verification process for coresight_etm_get_trace_id

The coresight_etm_get_trace_id function is a global function. The
verification process for 'csdev' is required prior to its usage.

Fixes: c367a89dec26 ("Coresight: Add trace_id function to retrieving the trace ID")
Signed-off-by: Jie Gan <quic_jiegan@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250310102724.2112905-1-quic_jiegan@quicinc.com

authored by

Jie Gan and committed by
Suzuki K Poulose
ab37128a f78d206f

+5 -2
+5 -2
drivers/hwtracing/coresight/coresight-core.c
··· 1616 1616 int coresight_etm_get_trace_id(struct coresight_device *csdev, enum cs_mode mode, 1617 1617 struct coresight_device *sink) 1618 1618 { 1619 - int trace_id; 1620 - int cpu = source_ops(csdev)->cpu_id(csdev); 1619 + int cpu, trace_id; 1621 1620 1621 + if (csdev->type != CORESIGHT_DEV_TYPE_SOURCE || !source_ops(csdev)->cpu_id) 1622 + return -EINVAL; 1623 + 1624 + cpu = source_ops(csdev)->cpu_id(csdev); 1622 1625 switch (mode) { 1623 1626 case CS_MODE_SYSFS: 1624 1627 trace_id = coresight_trace_id_get_cpu_id(cpu);