mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
perf arm_spe: Handle missing CPU IDs
Don't call strtol() with a null pointer to avoid undefined behavior. I'm not sure of the exact scenario for missing CPU IDs but I don't think it happens in practice. SPE decoding can continue without them with reduced functionality, but print an error message anyway. Reviewed-by: Leo Yan <leo.yan@arm.com> Signed-off-by: James Clark <james.clark@linaro.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
8e32bd775c
commit
0c7e4d11fb
|
|
@ -982,16 +982,23 @@ static int arm_spe__get_midr(struct arm_spe *spe, int cpu, u64 *midr)
|
|||
|
||||
pr_warning_once("Old SPE metadata, re-record to improve decode accuracy\n");
|
||||
cpuid = perf_env__cpuid(perf_session__env(spe->session));
|
||||
if (!cpuid)
|
||||
goto err;
|
||||
|
||||
*midr = strtol(cpuid, NULL, 16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
metadata = arm_spe__get_metadata_by_cpu(spe, cpu);
|
||||
if (!metadata)
|
||||
return -EINVAL;
|
||||
goto err;
|
||||
|
||||
*midr = metadata[ARM_SPE_CPU_MIDR];
|
||||
return 0;
|
||||
|
||||
err:
|
||||
pr_warning_once("Failed to get MIDR for CPU %d\n", cpu);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void arm_spe__synth_ds(struct arm_spe_queue *speq,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user