qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler
@ 2013-11-19 18:26 Don Koch
  2013-11-19 19:17 ` Stefan Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Don Koch @ 2013-11-19 18:26 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori

Prevent a call to put_kbd if null.

On shutdown of some OSes, the keyboard handler goes away before the
system is down. If a key is typed during this window, qemu crashes.

Signed-off-by: Don Koch <dkoch@verizon.com>
---
I left the printf call, originally for testing, but useful as a sanity
check if the user wonders why his keyboard input was ignored. AFAIC,
it can be removed.

PS: Anthony, your address in the MAINTAINER file is still at ibm.
I assume that is no longer correct, yes?

 ui/input.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ui/input.c b/ui/input.c
index 92c44ca..28ef6a6 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -415,8 +415,10 @@ void kbd_put_keycode(int keycode)
         return;
     }
     if (entry) {
-        entry->put_kbd(entry->opaque, keycode);
+        if (entry->put_kbd)
+            entry->put_kbd(entry->opaque, keycode);
+        else
+            printf("%s: no keyboard handler\n", __FUNCTION__);
     }
 }

-- 
1.8.1.4

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

* Re: [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler
  2013-11-19 18:26 [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler Don Koch
@ 2013-11-19 19:17 ` Stefan Weil
  2013-11-19 19:33   ` Don Koch
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Weil @ 2013-11-19 19:17 UTC (permalink / raw)
  To: Don Koch, qemu-devel, Anthony Liguori

Am 19.11.2013 19:26, schrieb Don Koch:
> Prevent a call to put_kbd if null.
>
> On shutdown of some OSes, the keyboard handler goes away before the
> system is down. If a key is typed during this window, qemu crashes.
>
> Signed-off-by: Don Koch <dkoch@verizon.com>
> ---
> I left the printf call, originally for testing, but useful as a sanity
> check if the user wonders why his keyboard input was ignored. AFAIC,
> it can be removed.

I'd remove that printf and combine the two if statements in the final patch.

>
> PS: Anthony, your address in the MAINTAINER file is still at ibm.
> I assume that is no longer correct, yes?

The address is correct in the latest git version.

>
>  ui/input.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/ui/input.c b/ui/input.c
> index 92c44ca..28ef6a6 100644
> --- a/ui/input.c
> +++ b/ui/input.c
> @@ -415,8 +415,10 @@ void kbd_put_keycode(int keycode)
>          return;
>      }
>      if (entry) {
> -        entry->put_kbd(entry->opaque, keycode);
> +        if (entry->put_kbd)
> +            entry->put_kbd(entry->opaque, keycode);
> +        else
> +            printf("%s: no keyboard handler\n", __FUNCTION__);
>      }
>  }
>


Please check the coding style with scripts/checkpatch.pl.

Regards,
Stefan Weil

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

* Re: [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler
  2013-11-19 19:17 ` Stefan Weil
@ 2013-11-19 19:33   ` Don Koch
  0 siblings, 0 replies; 3+ messages in thread
From: Don Koch @ 2013-11-19 19:33 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel, Don Koch, Anthony Liguori

On 11/19/2013 02:17 PM, Stefan Weil wrote:
> Am 19.11.2013 19:26, schrieb Don Koch:
>> Prevent a call to put_kbd if null.
>>
>> On shutdown of some OSes, the keyboard handler goes away before the
>> system is down. If a key is typed during this window, qemu crashes.
>>
>> Signed-off-by: Don Koch <dkoch@verizon.com>
>> ---
>> I left the printf call, originally for testing, but useful as a sanity
>> check if the user wonders why his keyboard input was ignored. AFAIC,
>> it can be removed.
> 
> I'd remove that printf and combine the two if statements in the final patch.

Works for me (if nobody thinks otherwise).

>>
>> PS: Anthony, your address in the MAINTAINER file is still at ibm.
>> I assume that is no longer correct, yes?
> 
> The address is correct in the latest git version.

Count on me to be in the wrong branch when I checked that.

>>
>>  ui/input.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/ui/input.c b/ui/input.c
>> index 92c44ca..28ef6a6 100644
>> --- a/ui/input.c
>> +++ b/ui/input.c
>> @@ -415,8 +415,10 @@ void kbd_put_keycode(int keycode)
>>          return;
>>      }
>>      if (entry) {
>> -        entry->put_kbd(entry->opaque, keycode);
>> +        if (entry->put_kbd)
>> +            entry->put_kbd(entry->opaque, keycode);
>> +        else
>> +            printf("%s: no keyboard handler\n", __FUNCTION__);
>>      }
>>  }
>>
> 
> 
> Please check the coding style with scripts/checkpatch.pl.

Of course, I remembered to do this afterwards. Turns out, the only
problems will go away if I drop the printf. I meant to send a follow-up
stating that and that I would wait to see what the consensus was on
the printf before applying the appropriate changes (thunderbird had
other ideas :-( ).

> 
> Regards,
> Stefan Weil

Thanks,
-d

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

end of thread, other threads:[~2013-11-19 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 18:26 [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler Don Koch
2013-11-19 19:17 ` Stefan Weil
2013-11-19 19:33   ` Don Koch

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).