lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 10 Nov 2022 12:02:53 +0100
From:   Amadeusz Sławiński 
        <amadeuszx.slawinski@...ux.intel.com>
To:     lishqchn <lishqchn@...com>, perex@...ex.cz, tiwai@...e.com
Cc:     alsa-devel@...a-project.org, broonie@...nel.org,
        lgirdwood@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Asoc: core: fix wrong size kzalloc for rtd's components
 member

On 11/8/2022 5:24 AM, lishqchn wrote:
> The actual space for struct snd_soc_component has been allocated by
> snd_soc_register_component, here rtd's components are pointers to
> components, I replace the base size from *component to component.
> 
> Signed-off-by: lishqchn <lishqchn@...com>
> ---
>   sound/soc/soc-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index a6d6d10cd471..d21e0284b2aa 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -459,7 +459,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
>   	 */
>   	rtd = devm_kzalloc(dev,
>   			   sizeof(*rtd) +
> -			   sizeof(*component) * (dai_link->num_cpus +
> +			   sizeof(component) * (dai_link->num_cpus +
>   						 dai_link->num_codecs +
>   						 dai_link->num_platforms),
>   			   GFP_KERNEL);

Can't struct_size macro be used instead, it is meant to be used when 
calculating size of structs containing flexible arrays at the end?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ