diff mbox

[PULL,2/5] input-linux: fix Coverity warning

Message ID 1458296795-29995-3-git-send-email-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gerd Hoffmann March 18, 2016, 10:26 a.m. UTC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1458129049-12484-1-git-send-email-kraxel@redhat.com
---
 ui/input-linux.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

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;