alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [patch] ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget()
@ 2013-07-31  8:52 Dan Carpenter
  2013-07-31  9:02 ` Lars-Peter Clausen
  2013-07-31 11:19 ` Mark Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-07-31  8:52 UTC (permalink / raw)
  To: Liam Girdwood, Lars-Peter Clausen
  Cc: Takashi Iwai, alsa-devel, Mark Brown, kernel-janitors

There is a typo here so we end up using the old freed pointer instead of
the newly allocated one.  (If the "n" is zero then the code works,
obviously).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 9abb3b2..d74c356 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -225,13 +225,13 @@ static int dapm_kcontrol_add_widget(struct snd_kcontrol *kcontrol,
 
 	new_data = krealloc(data, sizeof(*data) + sizeof(widget) * n,
 		GFP_KERNEL);
-	if (!data)
+	if (!new_data)
 		return -ENOMEM;
 
-	data->wlist.widgets[n - 1] = widget;
-	data->wlist.num_widgets = n;
+	new_data->wlist.widgets[n - 1] = widget;
+	new_data->wlist.num_widgets = n;
 
-	kcontrol->private_data = data;
+	kcontrol->private_data = new_data;
 
 	return 0;
 }

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

end of thread, other threads:[~2013-08-01  3:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31  8:52 [patch] ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget() Dan Carpenter
2013-07-31  9:02 ` Lars-Peter Clausen
2013-07-31 18:17   ` Olof Johansson
2013-07-31 18:33     ` Lars-Peter Clausen
2013-07-31 18:44       ` Lars-Peter Clausen
2013-07-31 20:05         ` Mark Brown
2013-08-01  3:49           ` Olof Johansson
2013-07-31 11:19 ` 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).