|
|
8afdf8 |
From 78212445de4c8e07873cbc7dff2abcacd031f151 Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Tue, 1 Jun 2021 17:47:42 +0200
|
|
|
8afdf8 |
Subject: [PATCH 1/9] alsactl: fix the nested iteration
|
|
|
f18a9b |
|
|
|
8afdf8 |
There may be nested iterations for hw: card names.
|
|
|
8afdf8 |
Handle this card name in snd_card_iterator_sinit().
|
|
|
f18a9b |
|
|
|
8afdf8 |
BugLink: https://github.com/alsa-project/alsa-lib/issues/142
|
|
|
8afdf8 |
Fixes: eefc2c6 ("alsactl: use card iterator functions for all card loops")
|
|
|
f18a9b |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
alsactl/utils.c | 2 ++
|
|
|
8afdf8 |
1 file changed, 2 insertions(+)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/alsactl/utils.c b/alsactl/utils.c
|
|
|
8afdf8 |
index c79fd95..881b505 100644
|
|
|
8afdf8 |
--- a/alsactl/utils.c
|
|
|
8afdf8 |
+++ b/alsactl/utils.c
|
|
|
8afdf8 |
@@ -247,6 +247,8 @@ int snd_card_iterator_sinit(struct snd_card_iterator *iter, const char *cardname
|
|
|
8afdf8 |
int cardno = -1;
|
|
|
f18a9b |
|
|
|
8afdf8 |
if (cardname) {
|
|
|
8afdf8 |
+ if (strncmp(cardname, "hw:", 3) == 0)
|
|
|
8afdf8 |
+ cardname += 3;
|
|
|
8afdf8 |
cardno = snd_card_get_index(cardname);
|
|
|
8afdf8 |
if (cardno < 0) {
|
|
|
8afdf8 |
error("Cannot find soundcard '%s'...", cardname);
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From 3d7a6facd9e1f962eef6c4ba3aa4cdc22477a6ac Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Chao Song <chao.song@linux.intel.com>
|
|
|
8afdf8 |
Date: Mon, 31 May 2021 10:29:57 +0800
|
|
|
8afdf8 |
Subject: [PATCH 2/9] topology: fix potential null pointer from strchr
|
|
|
8afdf8 |
|
|
|
8afdf8 |
This patch adds check to the return pointer from strchr,
|
|
|
8afdf8 |
because it may be null and cause segment fault, if component
|
|
|
8afdf8 |
is not properly constructed.
|
|
|
8afdf8 |
|
|
|
8afdf8 |
Fixes: https://github.com/alsa-project/alsa-utils/pull/91
|
|
|
8afdf8 |
Signed-off-by: Chao Song <chao.song@linux.intel.com>
|
|
|
f18a9b |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
topology/pre-process-dapm.c | 5 +++++
|
|
|
8afdf8 |
topology/pre-process-object.c | 5 +++++
|
|
|
8afdf8 |
2 files changed, 10 insertions(+)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/topology/pre-process-dapm.c b/topology/pre-process-dapm.c
|
|
|
8afdf8 |
index 450ca71..dbaf2f1 100644
|
|
|
8afdf8 |
--- a/topology/pre-process-dapm.c
|
|
|
8afdf8 |
+++ b/topology/pre-process-dapm.c
|
|
|
8afdf8 |
@@ -146,6 +146,11 @@ static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp,
|
|
|
8afdf8 |
|
|
|
8afdf8 |
/* get class name */
|
|
|
8afdf8 |
args = strchr(string, '.');
|
|
|
8afdf8 |
+ if (!args) {
|
|
|
8afdf8 |
+ SNDERR("Error getting class name for %s\n", string);
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
+ }
|
|
|
8afdf8 |
+
|
|
|
8afdf8 |
class_name = calloc(1, strlen(string) - strlen(args) + 1);
|
|
|
8afdf8 |
if (!class_name)
|
|
|
8afdf8 |
return -ENOMEM;
|
|
|
8afdf8 |
diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c
|
|
|
8afdf8 |
index 09aa375..ac8caec 100644
|
|
|
8afdf8 |
--- a/topology/pre-process-object.c
|
|
|
8afdf8 |
+++ b/topology/pre-process-object.c
|
|
|
8afdf8 |
@@ -492,6 +492,11 @@ static int tplg_pp_add_object_tuple_section(struct tplg_pre_processor *tplg_pp,
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
|
|
|
8afdf8 |
type = strchr(token_ref, '.');
|
|
|
8afdf8 |
+ if(!type) {
|
|
|
8afdf8 |
+ SNDERR("Error getting type for %s\n", token_ref);
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
f18a9b |
+ }
|
|
|
8afdf8 |
+
|
|
|
8afdf8 |
token = calloc(1, strlen(token_ref) - strlen(type) + 1);
|
|
|
8afdf8 |
if (!token)
|
|
|
8afdf8 |
return -ENOMEM;
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From d6d566a9eebb63dd9d1351b07d385d39cdc33beb Mon Sep 17 00:00:00 2001
|
|
|
f18a9b |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 09:53:56 +0200
|
|
|
8afdf8 |
Subject: [PATCH 3/9] alsactl: return error value in dump_config_tree()
|
|
|
f18a9b |
|
|
|
f18a9b |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
alsactl/alsactl.c | 2 +-
|
|
|
8afdf8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c
|
|
|
8afdf8 |
index a011284..05738fb 100644
|
|
|
8afdf8 |
--- a/alsactl/alsactl.c
|
|
|
8afdf8 |
+++ b/alsactl/alsactl.c
|
|
|
8afdf8 |
@@ -170,7 +170,7 @@ static int dump_config_tree(snd_config_t *top)
|
|
|
8afdf8 |
return err;
|
|
|
8afdf8 |
err = snd_config_save(top, out);
|
|
|
8afdf8 |
snd_output_close(out);
|
|
|
8afdf8 |
- return 0;
|
|
|
8afdf8 |
+ return err;
|
|
|
f18a9b |
}
|
|
|
f18a9b |
|
|
|
8afdf8 |
static int dump_state(const char *file)
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From 511dd7a597735048f3883ef7883adf853ac2de4a Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 09:56:20 +0200
|
|
|
8afdf8 |
Subject: [PATCH 4/9] alsactl: init() - return error value from
|
|
|
8afdf8 |
snd_card_iterator_sinit() call
|
|
|
8afdf8 |
|
|
|
8afdf8 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
---
|
|
|
8afdf8 |
alsactl/init_parse.c | 2 ++
|
|
|
8afdf8 |
1 file changed, 2 insertions(+)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
|
|
|
8afdf8 |
index 9d0f473..e439de7 100644
|
|
|
8afdf8 |
--- a/alsactl/init_parse.c
|
|
|
8afdf8 |
+++ b/alsactl/init_parse.c
|
|
|
8afdf8 |
@@ -1751,6 +1751,8 @@ int init(const char *cfgdir, const char *filename, int flags, const char *cardna
|
|
|
8afdf8 |
|
|
|
8afdf8 |
sysfs_init();
|
|
|
8afdf8 |
err = snd_card_iterator_sinit(&iter, cardname);
|
|
|
8afdf8 |
+ if (err < 0)
|
|
|
8afdf8 |
+ goto out;
|
|
|
8afdf8 |
while (snd_card_iterator_next(&iter)) {
|
|
|
8afdf8 |
err = snd_card_clean_cfgdir(cfgdir, iter.card);
|
|
|
8afdf8 |
if (err < 0) {
|
|
|
8afdf8 |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From 2bc595e7bd9a9b8f8605104cfdb8f40a07c2655b Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 09:58:46 +0200
|
|
|
8afdf8 |
Subject: [PATCH 5/9] alsactl: check for error values from snd_config_get...()
|
|
|
8afdf8 |
|
|
|
8afdf8 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
alsactl/state.c | 41 ++++++++++++++++++++++++++++-------------
|
|
|
8afdf8 |
1 file changed, 28 insertions(+), 13 deletions(-)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/alsactl/state.c b/alsactl/state.c
|
|
|
8afdf8 |
index 44fda3f..b3a3f4d 100644
|
|
|
8afdf8 |
--- a/alsactl/state.c
|
|
|
8afdf8 |
+++ b/alsactl/state.c
|
|
|
8afdf8 |
@@ -655,13 +655,16 @@ static long config_iface(snd_config_t *n)
|
|
|
8afdf8 |
const char *str;
|
|
|
8afdf8 |
switch (snd_config_get_type(n)) {
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_INTEGER:
|
|
|
8afdf8 |
- snd_config_get_integer(n, &i);
|
|
|
8afdf8 |
+ if (snd_config_get_integer(n, &i) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
return i;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_INTEGER64:
|
|
|
8afdf8 |
- snd_config_get_integer64(n, &li;;
|
|
|
8afdf8 |
+ if (snd_config_get_integer64(n, &li) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
return li;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_STRING:
|
|
|
8afdf8 |
- snd_config_get_string(n, &str);
|
|
|
8afdf8 |
+ if (snd_config_get_string(n, &str) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
break;
|
|
|
8afdf8 |
default:
|
|
|
8afdf8 |
return -1;
|
|
|
8afdf8 |
@@ -681,17 +684,20 @@ static int config_bool(snd_config_t *n, int doit)
|
|
|
f18a9b |
|
|
|
8afdf8 |
switch (snd_config_get_type(n)) {
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_INTEGER:
|
|
|
8afdf8 |
- snd_config_get_integer(n, &val;;
|
|
|
8afdf8 |
+ if (snd_config_get_integer(n, &val) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
if (val < 0 || val > 1)
|
|
|
8afdf8 |
return -1;
|
|
|
8afdf8 |
return val;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_INTEGER64:
|
|
|
8afdf8 |
- snd_config_get_integer64(n, &lval);
|
|
|
8afdf8 |
+ if (snd_config_get_integer64(n, &lval) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
if (lval < 0 || lval > 1)
|
|
|
8afdf8 |
return -1;
|
|
|
8afdf8 |
return (int) lval;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_STRING:
|
|
|
8afdf8 |
- snd_config_get_string(n, &str);
|
|
|
8afdf8 |
+ if (snd_config_get_string(n, &str) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
break;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_COMPOUND:
|
|
|
8afdf8 |
if (!force_restore || !doit)
|
|
|
8afdf8 |
@@ -718,13 +724,16 @@ static int config_enumerated(snd_config_t *n, snd_ctl_t *handle,
|
|
|
f18a9b |
|
|
|
8afdf8 |
switch (snd_config_get_type(n)) {
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_INTEGER:
|
|
|
8afdf8 |
- snd_config_get_integer(n, &val;;
|
|
|
8afdf8 |
+ if (snd_config_get_integer(n, &val) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
return val;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_INTEGER64:
|
|
|
8afdf8 |
- snd_config_get_integer64(n, &lval);
|
|
|
8afdf8 |
+ if (snd_config_get_integer64(n, &lval) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
return (int) lval;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_STRING:
|
|
|
8afdf8 |
- snd_config_get_string(n, &str);
|
|
|
8afdf8 |
+ if (snd_config_get_string(n, &str) < 0)
|
|
|
8afdf8 |
+ return -1;
|
|
|
8afdf8 |
break;
|
|
|
8afdf8 |
case SND_CONFIG_TYPE_COMPOUND:
|
|
|
8afdf8 |
if (!force_restore || !doit)
|
|
|
8afdf8 |
@@ -1247,6 +1256,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
if (strcmp(fld, "iface") == 0) {
|
|
|
8afdf8 |
iface = (snd_ctl_elem_iface_t)config_iface(n);
|
|
|
8afdf8 |
+ if (iface < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
continue;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
if (strcmp(fld, "device") == 0) {
|
|
|
8afdf8 |
@@ -1254,7 +1265,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
|
|
|
8afdf8 |
cerror(doit, "control.%d.%s is invalid", numid, fld);
|
|
|
8afdf8 |
return -EINVAL;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
- snd_config_get_integer(n, &device);
|
|
|
8afdf8 |
+ if (snd_config_get_integer(n, &device) < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
continue;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
if (strcmp(fld, "subdevice") == 0) {
|
|
|
8afdf8 |
@@ -1262,7 +1274,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
|
|
|
8afdf8 |
cerror(doit, "control.%d.%s is invalid", numid, fld);
|
|
|
8afdf8 |
return -EINVAL;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
- snd_config_get_integer(n, &subdevice);
|
|
|
8afdf8 |
+ if (snd_config_get_integer(n, &subdevice) < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
continue;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
if (strcmp(fld, "name") == 0) {
|
|
|
8afdf8 |
@@ -1270,7 +1283,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
|
|
|
8afdf8 |
cerror(doit, "control.%d.%s is invalid", numid, fld);
|
|
|
8afdf8 |
return -EINVAL;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
- snd_config_get_string(n, &name);
|
|
|
8afdf8 |
+ if (snd_config_get_string(n, &name) < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
continue;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
if (strcmp(fld, "index") == 0) {
|
|
|
8afdf8 |
@@ -1278,7 +1292,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
|
|
|
8afdf8 |
cerror(doit, "control.%d.%s is invalid", numid, fld);
|
|
|
8afdf8 |
return -EINVAL;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
- snd_config_get_integer(n, &index);
|
|
|
8afdf8 |
+ if (snd_config_get_integer(n, &index) < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
continue;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
if (strcmp(fld, "value") == 0) {
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From 646d6ff094a82153db49af176cba3aacbde46cf6 Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 10:04:50 +0200
|
|
|
8afdf8 |
Subject: [PATCH 6/9] =?UTF-8?q?alsactl:=20state=20-=20fix=20=E2=80=98item?=
|
|
|
8afdf8 |
=?UTF-8?q?=E2=80=99=20may=20be=20used=20uninitialized=20gcc=20warning?=
|
|
|
8afdf8 |
MIME-Version: 1.0
|
|
|
8afdf8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
8afdf8 |
Content-Transfer-Encoding: 8bit
|
|
|
f18a9b |
|
|
|
8afdf8 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
alsactl/state.c | 2 +-
|
|
|
8afdf8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
f18a9b |
|
|
|
8afdf8 |
diff --git a/alsactl/state.c b/alsactl/state.c
|
|
|
8afdf8 |
index b3a3f4d..9c75688 100644
|
|
|
8afdf8 |
--- a/alsactl/state.c
|
|
|
8afdf8 |
+++ b/alsactl/state.c
|
|
|
8afdf8 |
@@ -229,7 +229,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
|
|
|
8afdf8 |
{
|
|
|
8afdf8 |
snd_ctl_elem_value_t *ctl;
|
|
|
8afdf8 |
snd_ctl_elem_info_t *info;
|
|
|
8afdf8 |
- snd_config_t *control, *comment, *item, *value;
|
|
|
8afdf8 |
+ snd_config_t *control, *comment, *item = NULL, *value;
|
|
|
8afdf8 |
const char *s;
|
|
|
8afdf8 |
char buf[256];
|
|
|
8afdf8 |
unsigned int idx;
|
|
|
8afdf8 |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From cd2f779b8d6439479b9802e9fd2c8af86f8702fb Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 10:08:18 +0200
|
|
|
8afdf8 |
Subject: [PATCH 7/9] alsactl: fix lock_fd unlock in load_configuration() -
|
|
|
8afdf8 |
error path
|
|
|
f18a9b |
|
|
|
8afdf8 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
alsactl/utils.c | 6 ++++--
|
|
|
8afdf8 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/alsactl/utils.c b/alsactl/utils.c
|
|
|
8afdf8 |
index 881b505..fd4a108 100644
|
|
|
8afdf8 |
--- a/alsactl/utils.c
|
|
|
8afdf8 |
+++ b/alsactl/utils.c
|
|
|
8afdf8 |
@@ -220,15 +220,17 @@ int load_configuration(const char *file, snd_config_t **top, int *open_failed)
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
err = snd_config_load(config, in);
|
|
|
8afdf8 |
snd_input_close(in);
|
|
|
8afdf8 |
- if (lock_fd >= 0)
|
|
|
8afdf8 |
- state_unlock(lock_fd, file);
|
|
|
8afdf8 |
if (err < 0) {
|
|
|
8afdf8 |
error("snd_config_load error: %s", snd_strerror(err));
|
|
|
8afdf8 |
out:
|
|
|
8afdf8 |
+ if (lock_fd >= 0)
|
|
|
8afdf8 |
+ state_unlock(lock_fd, file);
|
|
|
8afdf8 |
snd_config_delete(config);
|
|
|
8afdf8 |
snd_config_update_free_global();
|
|
|
8afdf8 |
return err;
|
|
|
8afdf8 |
} else {
|
|
|
8afdf8 |
+ if (lock_fd >= 0)
|
|
|
8afdf8 |
+ state_unlock(lock_fd, file);
|
|
|
8afdf8 |
*top = config;
|
|
|
8afdf8 |
return 0;
|
|
|
f18a9b |
}
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From 74ad91245f8257e242cf5b5b6b809f94321f197a Mon Sep 17 00:00:00 2001
|
|
|
8afdf8 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 10:12:06 +0200
|
|
|
8afdf8 |
Subject: [PATCH 8/9] axfer: fix wrong calloc() item size in
|
|
|
8afdf8 |
allocate_containers()
|
|
|
f18a9b |
|
|
|
8afdf8 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
axfer/subcmd-transfer.c | 2 +-
|
|
|
8afdf8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/axfer/subcmd-transfer.c b/axfer/subcmd-transfer.c
|
|
|
8afdf8 |
index 27d2cc5..839215a 100644
|
|
|
8afdf8 |
--- a/axfer/subcmd-transfer.c
|
|
|
8afdf8 |
+++ b/axfer/subcmd-transfer.c
|
|
|
8afdf8 |
@@ -155,7 +155,7 @@ static int allocate_containers(struct context *ctx, unsigned int count)
|
|
|
8afdf8 |
return -ENOMEM;
|
|
|
8afdf8 |
ctx->cntr_count = count;
|
|
|
8afdf8 |
|
|
|
8afdf8 |
- ctx->cntr_fds = calloc(count, sizeof(*ctx->cntrs));
|
|
|
8afdf8 |
+ ctx->cntr_fds = calloc(count, sizeof(*ctx->cntr_fds));
|
|
|
8afdf8 |
if (ctx->cntr_fds == NULL)
|
|
|
8afdf8 |
return -ENOMEM;
|
|
|
f18a9b |
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|
|
|
f18a9b |
|
|
|
8afdf8 |
From c58f981e1530557835461b17b92eac6c475e5f68 Mon Sep 17 00:00:00 2001
|
|
|
f18a9b |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
8afdf8 |
Date: Fri, 4 Jun 2021 10:19:22 +0200
|
|
|
8afdf8 |
Subject: [PATCH 9/9] topology: fix few coverity detected defects
|
|
|
f18a9b |
|
|
|
f18a9b |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
f18a9b |
---
|
|
|
8afdf8 |
topology/pre-process-dapm.c | 3 ++-
|
|
|
8afdf8 |
topology/pre-process-object.c | 15 ++++++++++-----
|
|
|
8afdf8 |
topology/pre-processor.c | 2 +-
|
|
|
8afdf8 |
3 files changed, 13 insertions(+), 7 deletions(-)
|
|
|
8afdf8 |
|
|
|
8afdf8 |
diff --git a/topology/pre-process-dapm.c b/topology/pre-process-dapm.c
|
|
|
8afdf8 |
index dbaf2f1..dc510e1 100644
|
|
|
8afdf8 |
--- a/topology/pre-process-dapm.c
|
|
|
8afdf8 |
+++ b/topology/pre-process-dapm.c
|
|
|
8afdf8 |
@@ -203,7 +203,8 @@ static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp,
|
|
|
f18a9b |
|
|
|
8afdf8 |
if (!args) {
|
|
|
8afdf8 |
SNDERR("insufficient arugments for widget %s\n", string);
|
|
|
8afdf8 |
- return -EINVAL;
|
|
|
8afdf8 |
+ ret = -EINVAL;
|
|
|
8afdf8 |
+ goto err;
|
|
|
f18a9b |
}
|
|
|
8afdf8 |
|
|
|
8afdf8 |
remaining = strchr(args + 1, '.');
|
|
|
8afdf8 |
diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c
|
|
|
8afdf8 |
index ac8caec..7565091 100644
|
|
|
8afdf8 |
--- a/topology/pre-process-object.c
|
|
|
8afdf8 |
+++ b/topology/pre-process-object.c
|
|
|
8afdf8 |
@@ -463,7 +463,8 @@ static snd_config_t *tplg_object_lookup_in_config(struct tplg_pre_processor *tpl
|
|
|
8afdf8 |
if (!config_id)
|
|
|
8afdf8 |
return NULL;
|
|
|
8afdf8 |
|
|
|
8afdf8 |
- snd_config_search(class, config_id, &obj_cfg);
|
|
|
8afdf8 |
+ if (snd_config_search(class, config_id, &obj_cfg) < 0)
|
|
|
8afdf8 |
+ return NULL;
|
|
|
8afdf8 |
free(config_id);
|
|
|
8afdf8 |
return obj_cfg;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
@@ -704,11 +705,12 @@ static int tplg_add_object_data(struct tplg_pre_processor *tplg_pp, snd_config_t
|
|
|
8afdf8 |
|
|
|
8afdf8 |
ret = tplg_pp_add_object_tuple_section(tplg_pp, class_cfg, n, data_cfg_name,
|
|
|
8afdf8 |
token);
|
|
|
8afdf8 |
- free(data_cfg_name);
|
|
|
8afdf8 |
if (ret < 0) {
|
|
|
8afdf8 |
SNDERR("Failed to add data section %s\n", data_cfg_name);
|
|
|
8afdf8 |
+ free(data_cfg_name);
|
|
|
8afdf8 |
return ret;
|
|
|
f18a9b |
}
|
|
|
8afdf8 |
+ free(data_cfg_name);
|
|
|
f18a9b |
}
|
|
|
f18a9b |
|
|
|
8afdf8 |
return 0;
|
|
|
8afdf8 |
@@ -1215,8 +1217,10 @@ static int tplg_construct_object_name(struct tplg_pre_processor *tplg_pp, snd_co
|
|
|
8afdf8 |
return 0;
|
|
|
8afdf8 |
|
|
|
8afdf8 |
/* set class name as the name prefix for the object */
|
|
|
8afdf8 |
- snd_config_get_id(obj, &obj_id);
|
|
|
8afdf8 |
- snd_config_get_id(class_cfg, &class_id);
|
|
|
8afdf8 |
+ if (snd_config_get_id(obj, &obj_id) < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
+ if (snd_config_get_id(class_cfg, &class_id) < 0)
|
|
|
8afdf8 |
+ return -EINVAL;
|
|
|
8afdf8 |
new_name = strdup(class_id);
|
|
|
8afdf8 |
if (!new_name)
|
|
|
8afdf8 |
return -ENOMEM;
|
|
|
8afdf8 |
@@ -1280,7 +1284,8 @@ static int tplg_construct_object_name(struct tplg_pre_processor *tplg_pp, snd_co
|
|
|
8afdf8 |
default:
|
|
|
8afdf8 |
SNDERR("Argument '%s' in object '%s.%s' is not an integer or a string\n",
|
|
|
8afdf8 |
s, class_id, obj_id);
|
|
|
8afdf8 |
- return -EINVAL;
|
|
|
8afdf8 |
+ ret = -EINVAL;
|
|
|
8afdf8 |
+ goto err;
|
|
|
8afdf8 |
}
|
|
|
8afdf8 |
|
|
|
8afdf8 |
/* alloc and concat arg value to the name */
|
|
|
8afdf8 |
diff --git a/topology/pre-processor.c b/topology/pre-processor.c
|
|
|
8afdf8 |
index 0458c3c..442dcc4 100644
|
|
|
8afdf8 |
--- a/topology/pre-processor.c
|
|
|
8afdf8 |
+++ b/topology/pre-processor.c
|
|
|
8afdf8 |
@@ -183,7 +183,7 @@ int init_pre_precessor(struct tplg_pre_processor **tplg_pp, snd_output_type_t ty
|
|
|
8afdf8 |
|
|
|
8afdf8 |
_tplg_pp = calloc(1, sizeof(struct tplg_pre_processor));
|
|
|
8afdf8 |
if (!_tplg_pp)
|
|
|
8afdf8 |
- ret = -ENOMEM;
|
|
|
8afdf8 |
+ return -ENOMEM;
|
|
|
8afdf8 |
|
|
|
8afdf8 |
*tplg_pp = _tplg_pp;
|
|
|
8afdf8 |
|
|
|
f18a9b |
--
|
|
|
8afdf8 |
2.30.2
|
|
|
f18a9b |
|