]> www.infradead.org Git - users/dwmw2/linux.git/commit
cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get()
authorColin Ian King <colin.king@canonical.com>
Tue, 5 Jan 2021 10:19:57 +0000 (10:19 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 12:58:59 +0000 (13:58 +0100)
commitb4f18c95ae5d893385c117467130a88e8d87337a
tree1de238dafab4d89ef52660f2c3ed8c967ed1cdd3
parent3d87acd7e4ac0df83d8c8bb445923c415bf7171a
cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get()

commit 943bdd0cecad06da8392a33093230e30e501eccc upstream.

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()")
Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/powernow-k8.c