Re: [PATCH][V3] cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get
From: Rafael J. Wysocki
Date: Thu Jan 07 2021 - 11:40:38 EST
On Tue, Jan 5, 2021 at 11:22 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> 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>
Applied as 5.11-rc material, thanks!