Skip to content

Commit 41c5305

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: topology: Fix logic for copying tuples
Topology could have more instances of the tokens being searched for than the number of sets that need to be copied. Stop copying token after the limit of number of token instances has been reached. This worked before only by chance as we had allocated more size for the tuples array than the number of actual tokens being parsed. Fixes: 7006d20 ("ASoC: SOF: Introduce IPC3 ops") Signed-off-by: Ranjani Sridharan <[email protected] Reviewed-by: Péter Ujfalusi <[email protected] Reviewed-by: Bard Liao <[email protected] Reviewed-by: Pierre-Louis Bossart <[email protected] Signed-off-by: Peter Ujfalusi <[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]
1 parent 171b53b commit 41c5305

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sound/soc/sof/topology.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@ static int sof_copy_tuples(struct snd_sof_dev *sdev, struct snd_soc_tplg_vendor_
586586
if (*num_copied_tuples == tuples_size)
587587
return 0;
588588
}
589+
590+
/* stop when we've found the required token instances */
591+
if (found == num_tokens * token_instance_num)
592+
return 0;
589593
}
590594

591595
/* next array */

0 commit comments

Comments
 (0)