[bug report] perf: Add Arm CMN-600 PMU driver
Dan Carpenter
dan.carpenter at oracle.com
Wed Sep 30 10:34:44 EDT 2020
Hello Robin Murphy,
The patch 0ba64770a2f2: "perf: Add Arm CMN-600 PMU driver" from Sep
18, 2020, leads to the following static checker warning:
drivers/perf/arm-cmn.c:1156 arm_cmn_pmu_offline_cpu()
error: potential NULL dereference 'cmn'.
drivers/perf/arm-cmn.c
1150 static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
1151 {
1152 struct arm_cmn *cmn;
1153 unsigned int target;
1154
1155 cmn = hlist_entry_safe(node, struct arm_cmn, cpuhp_node);
1156 if (cpu != cmn->cpu)
^^^^^^^^
It doesn't make sense to use hlist_entry_safe() and then dereference
"cmn" without checking for NULL. It should either be hlist_entry() or
there should be a NULL check.
1157 return 0;
1158
1159 target = cpumask_any_but(cpu_online_mask, cpu);
1160 if (target >= nr_cpu_ids)
1161 return 0;
1162
1163 perf_pmu_migrate_context(&cmn->pmu, cpu, target);
1164 cmn->cpu = target;
1165 return 0;
1166 }
regards,
dan carpenter
More information about the linux-arm-kernel
mailing list