ASoC: core: fix wrong size kzalloc for rtd's components member
authorlishqchn <lishqchn@qq.com>
Tue, 8 Nov 2022 04:24:56 +0000 (12:24 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 15 Nov 2022 14:16:19 +0000 (14:16 +0000)
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@qq.com>
Link: https://lore.kernel.org/r/tencent_59850BB028662B6F2D49D7F3624AB84CCF05@qq.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index 12a82f5a3ff64ae2aedddb16164fb8d6075e445e..ec554c3bdafc378d28b037f96681c5196813a389 100644 (file)
@@ -447,7 +447,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);