Skip to content

Commit f661017

Browse files
Anastasia Belovavireshk
authored andcommitted
cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return 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>
1 parent f21401c commit f661017

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/cpufreq/brcmstb-avs-cpufreq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
481481
static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
482482
{
483483
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
484+
if (!policy)
485+
return 0;
484486
struct private_data *priv = policy->driver_data;
485487

486488
cpufreq_cpu_put(policy);

0 commit comments

Comments
 (0)