Skip to content

Commit 00a371a

Browse files
keesbroonie
authored andcommitted
ASoC: SOF: ipc4-pcm: Adjust pipeline_list->pipelines allocation type
In preparation for making the kmalloc family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) The assigned type is "struct snd_sof_pipeline **", but the returned type will be "struct snd_sof_widget **". These are the same size allocation (pointer size) but the types don't match. Adjust the allocation type to match the assignment. Signed-off-by: Kees Cook <[email protected]> Fixes: 9c04363 ("ASoC: SOF: Introduce struct snd_sof_pipeline") Acked-by: Peter Ujfalusi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 114a6e6 commit 00a371a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/soc/sof/ipc4-pcm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,8 @@ static int sof_ipc4_pcm_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
784784

785785
/* allocate memory for max number of pipeline IDs */
786786
pipeline_list->pipelines = kcalloc(ipc4_data->max_num_pipelines,
787-
sizeof(struct snd_sof_widget *), GFP_KERNEL);
787+
sizeof(*pipeline_list->pipelines),
788+
GFP_KERNEL);
788789
if (!pipeline_list->pipelines) {
789790
sof_ipc4_pcm_free(sdev, spcm);
790791
return -ENOMEM;

0 commit comments

Comments
 (0)