From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag9yc-0001HT-27 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:51:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag9yX-0007uy-TU for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:50:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag9yX-0007us-K0 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:50:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 3647A64D02 for ; Wed, 16 Mar 2016 11:50:53 +0000 (UTC) From: Gerd Hoffmann Date: Wed, 16 Mar 2016 12:50:49 +0100 Message-Id: <1458129049-12484-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] input-linux: fix Coverity warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- ui/input-linux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/input-linux.c b/ui/input-linux.c index 76a2abb..f884c00 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -257,6 +257,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