perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings
Hello Kim Phillips,
This is a semi-automatic email about new static checker warnings.
The patch 9fe8895a27a8: "perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings" from Aug 17, 2021, leads to the following Smatch complaint:
tools/perf/util/env.c:467 perf_env__cpuid()
error: we previously assumed 'env' could be null (see line 461)
tools/perf/util/env.c
457 const char *perf_env__cpuid(struct perf_env *env) 458 {
459 int status;
460
461 if (!env || !env->cpuid) { /* Assume local operation */
462 status = perf_env__read_cpuid(env);
463 if (status)
464 return NULL;
If env is NULL and perf_env__read_cpuid() return zero then we are toasted.
465 }
466
467 return env->cpuid;
468 }
A couple of the neighboring functions are written the same way. I'm not sure why they don't generate checker warnings.
regards,
dan carpenter