[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1b955086-94d0-d524-4cd4-b177df56f71c@linux.intel.com>
Date: Thu, 17 Mar 2022 08:21:11 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Yihao Han <hanyihao@...o.com>, Liam Girdwood <lgirdwood@...il.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Daniel Baluta <daniel.baluta@....com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
sound-open-firmware@...a-project.org, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Cc: kernel@...o.com
Subject: Re: [PATCH] ASoC: SOF: topology: Use kmemdup() to replace kzalloc +
memcpy
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@...o.com>
Thanks for the patch
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.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;
> }
>
Powered by blists - more mailing lists