public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Cc: Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: [patch] ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget()
Date: Wed, 31 Jul 2013 08:52:44 +0000	[thread overview]
Message-ID: <20130731085244.GB8210@elgon.mountain> (raw)

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;
 }

             reply	other threads:[~2013-07-31  8:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31  8:52 Dan Carpenter [this message]
2013-07-31  9:02 ` [patch] ASoC: dapm: using freed pointer in dapm_kcontrol_add_widget() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130731085244.GB8210@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox