* [patch] thermal: cpu_cooling: check for allocation failure
@ 2015-03-30 11:21 Dan Carpenter
2015-03-30 12:23 ` Javi Merino
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-03-30 11:21 UTC (permalink / raw)
To: Zhang Rui, Javi Merino; +Cc: Eduardo Valentin, linux-pm, kernel-janitors
If this fails, then we're likely in trouble anyway, but it's nice to
keep the code free from static checker warnings so you don't miss more
important bugs.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index c497414..3a01dfd 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -329,6 +329,10 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
}
power_table = kcalloc(num_opps, sizeof(*power_table), GFP_KERNEL);
+ if (!power_table) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
for (freq = 0, i = 0;
opp = dev_pm_opp_find_freq_ceil(dev, &freq), !IS_ERR(opp);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch] thermal: cpu_cooling: check for allocation failure
2015-03-30 11:21 [patch] thermal: cpu_cooling: check for allocation failure Dan Carpenter
@ 2015-03-30 12:23 ` Javi Merino
0 siblings, 0 replies; 2+ messages in thread
From: Javi Merino @ 2015-03-30 12:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Zhang Rui, Eduardo Valentin, linux-pm@vger.kernel.org,
kernel-janitors@vger.kernel.org
On Mon, Mar 30, 2015 at 12:21:44PM +0100, Dan Carpenter wrote:
> If this fails, then we're likely in trouble anyway, but it's nice to
> keep the code free from static checker warnings so you don't miss more
> important bugs.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index c497414..3a01dfd 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -329,6 +329,10 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
> }
>
> power_table = kcalloc(num_opps, sizeof(*power_table), GFP_KERNEL);
> + if (!power_table) {
> + ret = -ENOMEM;
> + goto unlock;
> + }
This fix is already in Eduardo's tree and is scheduled for 4.1:
https://git.kernel.org/cgit/linux/kernel/git/evalenti/linux-soc-thermal.git/commit/?h=linus&idea7db8371d1203adb871d240d46b040fd6b4e1d
Cheers,
Javi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-30 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-30 11:21 [patch] thermal: cpu_cooling: check for allocation failure Dan Carpenter
2015-03-30 12:23 ` Javi Merino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox