Skip to contentSkip to conversation

coverity fix in alsa-libs

PATCH Renu Tyagi 1 participant 1 message Sep 18, 2014

lore
Share & tools
lore

Renu Tyagi

author
#0 lore raw

Hi
Bug type : return negative value in case of error
I caught this error while running coverity on a older version. coverity will not give issue with latest version But As per my analysis negative error should be returned in these cases, for debugging later on. File changed : conf.c, control.c , pcm.c
PFA patch
-------------------------------------------------------------------------------------------
From d545d1ebedfbc42041e163536fbe2a6bd43361a0 Mon Sep 17 00:00:00 2001
From: renu tyagi <[email protected]>
Date: Thu, 18 Sep 2014 16:22:31 +0530
Subject: [PATCH 3/8] [conf, control, pcm] return negative value in case of error

---
 src/conf.c            |    1 +
 src/control/control.c |    1 +
 src/pcm/pcm.c         |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
src/conf.c +1 -0
index 5ccc8e1..bb256e7 100644
@@ -4198,6 +4198,7 @@ static int _snd_config_evaluate(snd_config_t *src,
                        snd_config_iterator_t i, next;
                        if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
                                SNDERR("Invalid type for func %s definition", str);
+                               err = -EINVAL;
                                goto _err;
                        }
                        snd_config_for_each(i, next, func_conf) {
src/control/control.c +1 -0
index d66ed75..dd428a1 100644
@@ -864,6 +864,7 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
        if (err >= 0) {
                if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
                        SNDERR("Invalid type for CTL type %s definition", str);
+                       err = -EINVAL;
                        goto _err;
                }
                snd_config_for_each(i, next, type_conf) {
src/pcm/pcm.c +1 -0
index 1399a5b..79359dc 100644
@@ -2143,6 +2143,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
        if (err >= 0) {
                if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
                        SNDERR("Invalid type for PCM type %s definition", str);
+                       err = -EINVAL;
                        goto _err;
                }
                snd_config_for_each(i, next, type_conf) {

--
1.7.1

Thanks
Renu Tyagi

From d545d1ebedfbc42041e163536fbe2a6bd43361a0 Mon Sep 17 00:00:00 2001
From: renu tyagi <[email protected]>
Date: Thu, 18 Sep 2014 16:22:31 +0530
Subject: [PATCH 3/8] [conf, control, pcm] return negative value in case of error

---
 src/conf.c            |    1 +
 src/control/control.c |    1 +
 src/pcm/pcm.c         |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
src/conf.c +1 -0
index 5ccc8e1..bb256e7 100644
@@ -4198,6 +4198,7 @@ static int _snd_config_evaluate(snd_config_t *src,
 			snd_config_iterator_t i, next;
 			if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
 				SNDERR("Invalid type for func %s definition", str);
+				err = -EINVAL;
 				goto _err;
 			}
 			snd_config_for_each(i, next, func_conf) {
src/control/control.c +1 -0
index d66ed75..dd428a1 100644
@@ -864,6 +864,7 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
 	if (err >= 0) {
 		if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
 			SNDERR("Invalid type for CTL type %s definition", str);
+			err = -EINVAL;
 			goto _err;
 		}
 		snd_config_for_each(i, next, type_conf) {
src/pcm/pcm.c +1 -0
index 1399a5b..79359dc 100644
@@ -2143,6 +2143,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
 	if (err >= 0) {
 		if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
 			SNDERR("Invalid type for PCM type %s definition", str);
+			err = -EINVAL;
 			goto _err;
 		}
 		snd_config_for_each(i, next, type_conf) {
Signature · 1 line
1.7.1