Skip to content

Commit ab37128

Browse files
Jie GanSuzuki K Poulose
authored andcommitted
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: c367a89 ("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
1 parent f78d206 commit ab37128

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/hwtracing/coresight/coresight-core.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,9 +1616,12 @@ EXPORT_SYMBOL_GPL(coresight_remove_driver);
16161616
int coresight_etm_get_trace_id(struct coresight_device *csdev, enum cs_mode mode,
16171617
struct coresight_device *sink)
16181618
{
1619-
int trace_id;
1620-
int cpu = source_ops(csdev)->cpu_id(csdev);
1619+
int cpu, trace_id;
1620+
1621+
if (csdev->type != CORESIGHT_DEV_TYPE_SOURCE || !source_ops(csdev)->cpu_id)
1622+
return -EINVAL;
16211623

1624+
cpu = source_ops(csdev)->cpu_id(csdev);
16221625
switch (mode) {
16231626
case CS_MODE_SYSFS:
16241627
trace_id = coresight_trace_id_get_cpu_id(cpu);

0 commit comments

Comments
 (0)