linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] drivers/mfd/palmas.c: drop kfree of devm_kzalloc's data
@ 2012-08-04 12:00 Julia Lawall
  2012-09-16 23:23 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-08-04 12:00 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: kernel-janitors, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Using kfree to free data allocated with devm_kzalloc causes double frees.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
@@

x = devm_kzalloc(...)
...
?-kfree(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/mfd/palmas.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index c4a69f1..92c6fc7 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -463,7 +463,6 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
 
 err:
 	mfd_remove_devices(palmas->dev);
-	kfree(palmas);
 	return ret;
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] drivers/mfd/palmas.c: drop kfree of devm_kzalloc's data
  2012-08-04 12:00 [PATCH 2/3] drivers/mfd/palmas.c: drop kfree of devm_kzalloc's data Julia Lawall
@ 2012-09-16 23:23 ` Samuel Ortiz
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2012-09-16 23:23 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-kernel

Hi Julia,

On Sat, Aug 04, 2012 at 02:00:31PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Using kfree to free data allocated with devm_kzalloc causes double frees.
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x;
> @@
> 
> x = devm_kzalloc(...)
> ...
> ?-kfree(x);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/mfd/palmas.c |    1 -
>  1 file changed, 1 deletion(-)
Applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-16 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-04 12:00 [PATCH 2/3] drivers/mfd/palmas.c: drop kfree of devm_kzalloc's data Julia Lawall
2012-09-16 23:23 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).