All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod}
@ 2013-05-24  8:12 Juho Hämäläinen
  2013-05-24 10:50 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Juho Hämäläinen @ 2013-05-24  8:12 UTC (permalink / raw)
  To: alsa-devel

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"))
-- 
1.7.10.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod}
  2013-05-24  8:12 [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod} Juho Hämäläinen
@ 2013-05-24 10:50 ` Takashi Iwai
  2013-05-24 11:01   ` Juho Hämäläinen
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2013-05-24 10:50 UTC (permalink / raw)
  To: Juho Hämäläinen; +Cc: alsa-devel

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod}
  2013-05-24 10:50 ` Takashi Iwai
@ 2013-05-24 11:01   ` Juho Hämäläinen
  2013-05-24 11:05     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Juho Hämäläinen @ 2013-05-24 11:01 UTC (permalink / raw)
  To: 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);
-- 
1.7.10.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod}
  2013-05-24 11:01   ` Juho Hämäläinen
@ 2013-05-24 11:05     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2013-05-24 11:05 UTC (permalink / raw)
  To: Juho Hämäläinen; +Cc: alsa-devel

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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-24 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24  8:12 [PATCH] ucm: Fix segfault when device argument is missing from _sw{dev, mod} Juho Hämäläinen
2013-05-24 10:50 ` Takashi Iwai
2013-05-24 11:01   ` Juho Hämäläinen
2013-05-24 11:05     ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.