qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 2/3] input-linux: fix Coverity warning


From: Gerd Hoffmann
Subject: [Qemu-devel] [PULL 2/3] input-linux: fix Coverity warning
Date: Thu, 24 Mar 2016 08:56:17 +0100

Signed-off-by: Gerd Hoffmann <address@hidden>
Message-id: address@hidden
---
 ui/input-linux.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ui/input-linux.c b/ui/input-linux.c
index 59d9348..6ddaa67 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -213,6 +213,13 @@ static void input_linux_event_keyboard(void *opaque)
                  */
                 continue;
             }
+            if (event.code >= KEY_CNT) {
+                /*
+                 * Should not happen.  But better safe than sorry,
+                 * and we make Coverity happy too.
+                 */
+                continue;
+            }
             /* keep track of key state */
             if (!il->keydown[event.code] && event.value) {
                 il->keydown[event.code] = true;
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]