From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Samuel Holland <samuel@sholland.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs
Date: 05 Aug 2021 14:14:53 +0900 [thread overview]
Message-ID: <87eeb8tquq.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <20210805050706.46833-1-samuel@sholland.org>
Hi Samuel
Thank you for your patch
> The allocation of the DAI link components (DLCs) passed the wrong
> pointer to sizeof. Since simple_dai_props is much larger than
> snd_soc_dai_link_component, there was no out of bounds access, only
> wasted memory.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
Wow indeed !
Thank you for your fixup
Fixes: f2138aed231c8 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Fixes: 050c7950fd706 ("ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform")
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> sound/soc/generic/simple-card-utils.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
> index 677f7da93b4b..10c63b73900c 100644
> --- a/sound/soc/generic/simple-card-utils.c
> +++ b/sound/soc/generic/simple-card-utils.c
> @@ -640,8 +640,8 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
> cnf_num += li->num[i].codecs;
> }
>
> - dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL);
> - dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dai_props), GFP_KERNEL);
> + dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL);
> + dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dlcs), GFP_KERNEL);
> if (!dais || !dlcs)
> return -ENOMEM;
>
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-08-05 5:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-05 5:07 [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs Samuel Holland
2021-08-05 5:14 ` Kuninori Morimoto [this message]
2021-08-05 12:32 ` Mark Brown
2021-08-06 0:47 ` 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=87eeb8tquq.wl-kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx@renesas.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=samuel@sholland.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;
as well as URLs for NNTP newsgroup(s).