Skip to content

Commit

Permalink
cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return …
Browse files Browse the repository at this point in the history
…value

cpufreq_cpu_get may return NULL. To avoid NULL-dereference check it
and return 0 in case of error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: de322e0 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
  • Loading branch information
Anastasia Belova authored and Viresh Kumar committed Jan 23, 2024
1 parent f21401c commit f661017
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/cpufreq/brcmstb-avs-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
{
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
if (!policy)
return 0;
struct private_data *priv = policy->driver_data;

cpufreq_cpu_put(policy);
Expand Down

0 comments on commit f661017

Please sign in to comment.