From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
To: Joe Perches <joe@perches.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] ASoC: Intel: Atom: add a missing star in a memcpy call
Date: Sun, 28 Aug 2016 20:31:26 +0200 [thread overview]
Message-ID: <c6077e34-64d9-c030-c23a-e2f246deb3ee@m4x.org> (raw)
In-Reply-To: <1472408231.26978.98.camel@perches.com>
On 28/08/16 20:17, Joe Perches wrote:
> On Sun, 2016-08-28 at 19:39 +0200, Nicolas Iooss wrote:
>> In sst_prepare_and_post_msg(), when a response is received in "block",
>> the following code gets executed:
>>
>> *data = kzalloc(block->size, GFP_KERNEL);
>> memcpy(data, (void *) block->data, block->size);
>>
>> The memcpy() call overwrites the content of the *data pointer instead of
>> filling the newly-allocated memory (which pointer is hold by *data).
>> Fix this by using *data in the memcpy() call.
>>
>> Fixes: 60dc8dbacb00 ("ASoC: Intel: sst: Add some helper functions")
>> Cc: stable@vger.kernel.org # 3.19.x
>> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
>> ---
>> sound/soc/intel/atom/sst/sst_pvt.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/soc/intel/atom/sst/sst_pvt.c b/sound/soc/intel/atom/sst/sst_pvt.c
>> index adb32fefd693..7c398b7c9d4b 100644
>> --- a/sound/soc/intel/atom/sst/sst_pvt.c
>> +++ b/sound/soc/intel/atom/sst/sst_pvt.c
>> @@ -289,7 +289,7 @@ int sst_prepare_and_post_msg(struct intel_sst_drv *sst,
>> ret = -ENOMEM;
>> goto out;
>> } else
>> - memcpy(data, (void *) block->data, block->size);
>> + memcpy(*data, (void *) block->data, block->size);
>> }
>> }
>> out:
>
> Perhaps this would be nicer using kmemdup too
Thanks for your quick reply! I agree using kmemdup looks nicer here and
your patch looks good. I will send a v2 once I compile-tested it.
Nicolas
prev parent reply other threads:[~2016-08-28 18:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-28 17:39 Nicolas Iooss
2016-08-28 17:50 ` Misuses of ** ? (was Re: [PATCH 1/1] ASoC: Intel: Atom: add a missing star in a memcpy call) Joe Perches
2016-08-28 18:52 ` Nicolas Iooss
2016-08-28 19:38 ` Julia Lawall
2016-08-28 20:34 ` Joe Perches
2016-08-28 21:40 ` Julia Lawall
2016-08-28 21:54 ` Joe Perches
2016-08-28 18:17 ` [PATCH 1/1] ASoC: Intel: Atom: add a missing star in a memcpy call Joe Perches
2016-08-28 18:31 ` Nicolas Iooss [this message]
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=c6077e34-64d9-c030-c23a-e2f246deb3ee@m4x.org \
--to=nicolas.iooss_linux@m4x.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=joe@perches.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®