From: Gerd Hoffmann Date: Wed, 16 Mar 2016 11:50:49 +0000 (+0100) Subject: input-linux: fix Coverity warning X-Git-Tag: v2.6.0-rc0~11^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81b00c968a86250684b49d528a7841c4abe0b1c9;p=thirdparty%2Fqemu.git input-linux: fix Coverity warning Signed-off-by: Gerd Hoffmann Message-id: 1458129049-12484-1-git-send-email-kraxel@redhat.com --- diff --git a/ui/input-linux.c b/ui/input-linux.c index 59d93485ec5..6ddaa6740fd 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;