[alsa-devel] [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod}
Signed-off-by: Juho Hämäläinen juho.hamalainen@tieto.com --- src/ucm/main.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/ucm/main.c b/src/ucm/main.c index d38b7fa..74e1530 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -1649,6 +1649,10 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, } else { str = NULL; } + if (!str) { + err = -EINVAL; + goto __end; + } if (check_identifier(identifier, "_swdev")) err = switch_device(uc_mgr, str, value); else if (check_identifier(identifier, "_swmod"))
At Fri, 24 May 2013 11:12:57 +0300, Juho Hämäläinen wrote:
Signed-off-by: Juho Hämäläinen juho.hamalainen@tieto.com
src/ucm/main.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/ucm/main.c b/src/ucm/main.c index d38b7fa..74e1530 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -1649,6 +1649,10 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, } else { str = NULL; }
if (!str) {
err = -EINVAL;
goto __end;
}
It's more straightforward to fold the error path into the else block in the above.
thanks,
Takashi
if (check_identifier(identifier, "_swdev")) err = switch_device(uc_mgr, str, value); else if (check_identifier(identifier, "_swmod"))
-- 1.7.10.4
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signed-off-by: Juho Hämäläinen juho.hamalainen@tieto.com --- src/ucm/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ucm/main.c b/src/ucm/main.c index d38b7fa..0494728 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -1647,7 +1647,8 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, goto __end; } } else { - str = NULL; + err = -EINVAL; + goto __end; } if (check_identifier(identifier, "_swdev")) err = switch_device(uc_mgr, str, value);
At Fri, 24 May 2013 14:01:25 +0300, Juho Hämäläinen wrote:
Signed-off-by: Juho Hämäläinen juho.hamalainen@tieto.com
Thanks, applied.
Takashi
src/ucm/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ucm/main.c b/src/ucm/main.c index d38b7fa..0494728 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -1647,7 +1647,8 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, goto __end; } } else {
str = NULL;
err = -EINVAL;
goto __end; } if (check_identifier(identifier, "_swdev")) err = switch_device(uc_mgr, str, value);
-- 1.7.10.4
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Juho Hämäläinen
-
Takashi Iwai