summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-topology.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 19:24:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 19:24:19 +0000
commit2008b239ed2e38dd466ddc93f587a088bd558b71 (patch)
treeeb37b8a1f852d4b842862b002c1da338ee11d9d2 /sound/soc/soc-topology.c
parentAdding upstream version 6.9.10. (diff)
downloadlinux-2008b239ed2e38dd466ddc93f587a088bd558b71.tar.xz
linux-2008b239ed2e38dd466ddc93f587a088bd558b71.zip
Adding upstream version 6.9.11.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sound/soc/soc-topology.c')
-rw-r--r--sound/soc/soc-topology.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index ba4890991f..ce22613bf9 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1060,15 +1060,28 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
break;
}
- route->source = elem->source;
- route->sink = elem->sink;
+ route->source = devm_kmemdup(tplg->dev, elem->source,
+ min(strlen(elem->source),
+ SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+ GFP_KERNEL);
+ route->sink = devm_kmemdup(tplg->dev, elem->sink,
+ min(strlen(elem->sink), SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+ GFP_KERNEL);
+ if (!route->source || !route->sink) {
+ ret = -ENOMEM;
+ break;
+ }
- /* set to NULL atm for tplg users */
- route->connected = NULL;
- if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0)
- route->control = NULL;
- else
- route->control = elem->control;
+ if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) != 0) {
+ route->control = devm_kmemdup(tplg->dev, elem->control,
+ min(strlen(elem->control),
+ SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+ GFP_KERNEL);
+ if (!route->control) {
+ ret = -ENOMEM;
+ break;
+ }
+ }
/* add route dobj to dobj_list */
route->dobj.type = SND_SOC_DOBJ_GRAPH;