Re: [PATCH][V3] cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get

From: Viresh Kumar
Date: Tue Jan 05 2021 - 05:22:00 EST


On 05-01-21, 10:19, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> Currently there is an unlikely case where cpufreq_cpu_get returns a
> null policy and this will cause a null pointer dereference later on.
> Fix this by passing the policy to transition_frequency_fidvid from the
> caller and hence eliminating the need for the cpufreq_cpu_get and
> cpufreq_cpu_put. Thanks to Viresh Kumar for suggesting the fix.
>
> Addresses-Coverity: ("Dereference null return")
> Fixes: b43a7ffbf33b ("cpufreq: Notify all policy->cpus in cpufreq_notify_transition()")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
>
> V2: pass the policy to transition_frequency_fidvid rather than add
> a null pointer check on the return from a cpufreq_cpu_get call.
> V3: update subject line to match the fix
>
> ---
> drivers/cpufreq/powernow-k8.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

--
viresh