From patchwork Fri Aug 17 13:50:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 178209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E10862C0098 for ; Fri, 17 Aug 2012 23:50:58 +1000 (EST) Received: from localhost ([::1]:59854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Mwy-0002Ks-GU for incoming@patchwork.ozlabs.org; Fri, 17 Aug 2012 09:50:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Mwr-0002KE-E5 for qemu-devel@nongnu.org; Fri, 17 Aug 2012 09:50:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2Mwp-0000yM-4z for qemu-devel@nongnu.org; Fri, 17 Aug 2012 09:50:49 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:42354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Mwo-0000xw-VZ for qemu-devel@nongnu.org; Fri, 17 Aug 2012 09:50:47 -0400 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id 3E85A7280027; Fri, 17 Aug 2012 15:50:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DmYrNVgQs1BT; Fri, 17 Aug 2012 15:50:45 +0200 (CEST) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id C2DE0728002E; Fri, 17 Aug 2012 15:50:45 +0200 (CEST) From: Stefan Weil To: qemu-devel@nongnu.org, Anthony Liguori Date: Fri, 17 Aug 2012 15:50:44 +0200 Message-Id: <1345211444-5002-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 78.47.199.172 Cc: Jan Kiszka , Stefan Weil Subject: [Qemu-devel] [PATCH for 1.2] console: Fix warning from clang (and potential crash) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ccc-analyzer reports this warning: console.c:1090:29: warning: Dereference of null pointer if (active_console->cursor_timer) { ^ Function console_select allows active_console to be NULL, but would crash when accessing cursor_timer. Fix this. Signed-off-by: Stefan Weil Reviewed-by: Jan Kiszka --- Please note that I don't have a test case which triggers the crash. Regards, Stefan Weil console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console.c b/console.c index 4525cc7..f5e8814 100644 --- a/console.c +++ b/console.c @@ -1087,7 +1087,7 @@ void console_select(unsigned int index) if (s) { DisplayState *ds = s->ds; - if (active_console->cursor_timer) { + if (active_console && active_console->cursor_timer) { qemu_del_timer(active_console->cursor_timer); } active_console = s;