diff options
author | Ranjani Sridharan <[email protected]> | 2023-05-12 14:46:30 +0300 |
---|---|---|
committer | Mark Brown <[email protected]> | 2023-05-15 10:21:15 +0900 |
commit | 41c5305cc3d827d2ea686533777a285176ae01a0 (patch) | |
tree | c2aa17b9f63ad771e63ef21f0dce5a4b387e9ea3 | |
parent | 171b53be635ac15d4feafeb33946035649b1ca14 (diff) |
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: 7006d20e5e9d ("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]
-rw-r--r-- | sound/soc/sof/topology.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index d3d536b0a8f5..b80566570512 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -586,6 +586,10 @@ static int sof_copy_tuples(struct snd_sof_dev *sdev, struct snd_soc_tplg_vendor_ if (*num_copied_tuples == tuples_size) return 0; } + + /* stop when we've found the required token instances */ + if (found == num_tokens * token_instance_num) + return 0; } /* next array */ |