linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] sound/soc/soc-core.c: drop kfree of devm_kzalloc's data
@ 2012-12-08 18:01 Julia Lawall
  2012-12-10  5:23 ` Mark Brown
  2012-12-10  7:18 ` Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2012-12-08 18:01 UTC (permalink / raw)
  To: Liam Girdwood, matthias
  Cc: kernel-janitors, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, 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>

---
The kfrees were introduced in b761c0ca.
I sent this a few months ago, and I still think it should be applied...

 sound/soc/soc-core.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f81c597..86d7a36 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4136,7 +4136,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 			dev_err(card->dev,
 				"Property '%s' index %d could not be read: %d\n",
 				propname, 2 * i, ret);
-			kfree(routes);
 			return -EINVAL;
 		}
 		ret = of_property_read_string_index(np, propname,
@@ -4145,7 +4144,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 			dev_err(card->dev,
 				"Property '%s' index %d could not be read: %d\n",
 				propname, (2 * i) + 1, ret);
-			kfree(routes);
 			return -EINVAL;
 		}
 	}


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 3/3] sound/soc/soc-core.c: drop kfree of devm_kzalloc's data
@ 2012-08-04 12:00 Julia Lawall
  2012-08-04 14:32 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2012-08-04 12:00 UTC (permalink / raw)
  To: Liam Girdwood, matthias
  Cc: kernel-janitors, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, 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>

---
The kfrees were introduced in b761c0ca.

 sound/soc/soc-core.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f81c597..86d7a36 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4136,7 +4136,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 			dev_err(card->dev,
 				"Property '%s' index %d could not be read: %d\n",
 				propname, 2 * i, ret);
-			kfree(routes);
 			return -EINVAL;
 		}
 		ret = of_property_read_string_index(np, propname,
@@ -4145,7 +4144,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 			dev_err(card->dev,
 				"Property '%s' index %d could not be read: %d\n",
 				propname, (2 * i) + 1, ret);
-			kfree(routes);
 			return -EINVAL;
 		}
 	}


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

end of thread, other threads:[~2012-12-10  7:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-08 18:01 [PATCH 3/3] sound/soc/soc-core.c: drop kfree of devm_kzalloc's data Julia Lawall
2012-12-10  5:23 ` Mark Brown
2012-12-10  6:10   ` Julia Lawall
2012-12-10  7:09     ` Mark Brown
2012-12-10  7:18 ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2012-08-04 12:00 Julia Lawall
2012-08-04 14:32 ` Mark Brown

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).