qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ccid: Fix crash when backend isn't specified
@ 2013-04-14 20:06 Cole Robinson
  2013-04-15  8:03 ` Alon Levy
  0 siblings, 1 reply; 2+ messages in thread
From: Cole Robinson @ 2013-04-14 20:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: alevy, kraxel, Cole Robinson

Reproducer:

./x86_64-softmmu/qemu-system-x86_64 -device usb-ccid,id=ccid0 -usb -device ccid-card-emulated -monitor stdio

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 hw/usb/ccid-card-emulated.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index 29dcd7a..65e1432 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -500,9 +500,15 @@ static int emulated_initfn(CCIDCardState *base)
     if (init_pipe_signaling(card) < 0) {
         return -1;
     }
-    card->backend = parse_enumeration(card->backend_str, backend_enum_table, 0);
+
+    card->backend = 0;
+    if (card->backend_str) {
+        card->backend = parse_enumeration(card->backend_str,
+                                          backend_enum_table, 0);
+    }
+
     if (card->backend == 0) {
-        printf("unknown backend, must be one of:\n");
+        printf("backend must be one of:\n");
         for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) {
             printf("%s\n", ptable->name);
         }
-- 
1.8.1.4

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

* Re: [Qemu-devel] [PATCH] ccid: Fix crash when backend isn't specified
  2013-04-14 20:06 [Qemu-devel] [PATCH] ccid: Fix crash when backend isn't specified Cole Robinson
@ 2013-04-15  8:03 ` Alon Levy
  0 siblings, 0 replies; 2+ messages in thread
From: Alon Levy @ 2013-04-15  8:03 UTC (permalink / raw)
  To: Cole Robinson, mlureau; +Cc: qemu-devel, kraxel

On Sun, 2013-04-14 at 16:06 -0400, Cole Robinson wrote:
> Reproducer:
> 
> ./x86_64-softmmu/qemu-system-x86_64 -device usb-ccid,id=ccid0 -usb -device ccid-card-emulated -monitor stdio
> 

ACK, thanks.

Marc-Andre, could you review the fixed patches I sent previously, and
then I can put this on top and send a pull request?

http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg04927.html

> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
>  hw/usb/ccid-card-emulated.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
> index 29dcd7a..65e1432 100644
> --- a/hw/usb/ccid-card-emulated.c
> +++ b/hw/usb/ccid-card-emulated.c
> @@ -500,9 +500,15 @@ static int emulated_initfn(CCIDCardState *base)
>      if (init_pipe_signaling(card) < 0) {
>          return -1;
>      }
> -    card->backend = parse_enumeration(card->backend_str, backend_enum_table, 0);
> +
> +    card->backend = 0;
> +    if (card->backend_str) {
> +        card->backend = parse_enumeration(card->backend_str,
> +                                          backend_enum_table, 0);
> +    }
> +
>      if (card->backend == 0) {
> -        printf("unknown backend, must be one of:\n");
> +        printf("backend must be one of:\n");
>          for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) {
>              printf("%s\n", ptable->name);
>          }
> -- 
> 1.8.1.4
> 
> 

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

end of thread, other threads:[~2013-04-15  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-14 20:06 [Qemu-devel] [PATCH] ccid: Fix crash when backend isn't specified Cole Robinson
2013-04-15  8:03 ` Alon Levy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).