aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-03-28 23:39:22 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-04-07 18:00:40 +1000
commitab30f78c0afbb86584144925e25c7ca68ba9a91f (patch)
tree2ddd3972415c317c89b7c983463952721e04f5e4 /drivers/macintosh
parent637a99022fb119b90fb281715d13172f0394fc12 (diff)
downloadkernel_samsung_espresso10-ab30f78c0afbb86584144925e25c7ca68ba9a91f.zip
kernel_samsung_espresso10-ab30f78c0afbb86584144925e25c7ca68ba9a91f.tar.gz
kernel_samsung_espresso10-ab30f78c0afbb86584144925e25c7ca68ba9a91f.tar.bz2
powerpc/pmac/windfarm: Correct potential double free
The conditionals were testing different values, but then all freeing the same one, which could result in a double free. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,e; identifier f; iterator I; statement S; @@ *kfree(x); ... when != &x when != x = e when != I(x,...) S *x // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/windfarm_pm91.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index bea9916..3442732 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -687,12 +687,9 @@ static int __devexit wf_smu_remove(struct platform_device *ddev)
wf_put_control(cpufreq_clamp);
/* Destroy control loops state structures */
- if (wf_smu_slots_fans)
- kfree(wf_smu_cpu_fans);
- if (wf_smu_drive_fans)
- kfree(wf_smu_cpu_fans);
- if (wf_smu_cpu_fans)
- kfree(wf_smu_cpu_fans);
+ kfree(wf_smu_slots_fans);
+ kfree(wf_smu_drive_fans);
+ kfree(wf_smu_cpu_fans);
return 0;
}