From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Yihao Han <hanyihao@vivo.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
sound-open-firmware@alsa-project.org,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Cc: kernel@vivo.com
Subject: Re: [PATCH] ASoC: SOF: topology: Use kmemdup() to replace kzalloc + memcpy
Date: Thu, 17 Mar 2022 08:21:11 -0500 [thread overview]
Message-ID: <1b955086-94d0-d524-4cd4-b177df56f71c@linux.intel.com> (raw)
In-Reply-To: <20220317093841.3414-1-hanyihao@vivo.com>
On 3/17/22 04:38, Yihao Han wrote:
> fix memdup.cocci warning:
> sound/soc/sof/topology.c:876:19-26: WARNING opportunity for kmemdup
>
> Generated by: scripts/coccinelle/api/memdup.cocci
>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
Thanks for the patch
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> sound/soc/sof/topology.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
> index 367fbe2d5b31..369693cc6d10 100644
> --- a/sound/soc/sof/topology.c
> +++ b/sound/soc/sof/topology.c
> @@ -873,11 +873,10 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp,
>
> /* copy the private data */
> if (priv_size > 0) {
> - scontrol->priv = kzalloc(priv_size, GFP_KERNEL);
> + scontrol->priv = kmemdup(control->priv.data, priv_size, GFP_KERNEL);
> if (!scontrol->priv)
> return -ENOMEM;
>
> - memcpy(scontrol->priv, control->priv.data, priv_size);
> scontrol->priv_size = priv_size;
> }
>
next prev parent reply other threads:[~2022-03-17 14:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-17 9:38 [PATCH] ASoC: SOF: topology: Use kmemdup() to replace kzalloc + memcpy Yihao Han
2022-03-17 13:21 ` Pierre-Louis Bossart [this message]
2022-03-17 19:15 ` 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=1b955086-94d0-d524-4cd4-b177df56f71c@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=hanyihao@vivo.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kernel@vivo.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.com \
/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