From patchwork Wed Jan 4 21:50:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 134852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4127FB6F99 for ; Sun, 8 Jan 2012 00:36:56 +1100 (EST) Received: from localhost ([::1]:37603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjWS4-0000OK-5l for incoming@patchwork.ozlabs.org; Sat, 07 Jan 2012 08:36:52 -0500 Received: from eggs.gnu.org ([140.186.70.92]:45446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjWRz-0000O9-4V for qemu-devel@nongnu.org; Sat, 07 Jan 2012 08:36:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjWRx-0006Zb-SV for qemu-devel@nongnu.org; Sat, 07 Jan 2012 08:36:47 -0500 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:59750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjWRx-0006ZX-Mi for qemu-devel@nongnu.org; Sat, 07 Jan 2012 08:36:45 -0500 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id 448D7728000B; Wed, 4 Jan 2012 22:50:37 +0100 (CET) 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 Y1K+-h4OYxP4; Wed, 4 Jan 2012 22:50:09 +0100 (CET) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id E6A5B728000C; Wed, 4 Jan 2012 22:50:09 +0100 (CET) From: Stefan Weil To: qemu-devel@nongnu.org Date: Wed, 4 Jan 2012 22:50:09 +0100 Message-Id: <1325713809-10461-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 78.47.199.172 Cc: Stefan Weil , Shin-ichiro Kawasaki Subject: [Qemu-devel] [PATCH] sm501: Fix size of color_reg 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 color_reg is expected to hold 32 bit values, so it was too small. This bug was reported by coverity: hw/sm501.c:624: result_independent_of_operands: color_reg >> 16 is 0 regardless of the values of its operands. This occurs as the bitwise first operand of '&'. Cc: Shin-ichiro Kawasaki Signed-off-by: Stefan Weil --- hw/sm501.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/sm501.c b/hw/sm501.c index 326531c..09c5894 100644 --- a/hw/sm501.c +++ b/hw/sm501.c @@ -593,7 +593,7 @@ static inline uint32_t get_hwc_x(SM501State *state, int crt) */ static inline uint16_t get_hwc_color(SM501State *state, int crt, int index) { - uint16_t color_reg = 0; + uint32_t color_reg = 0; uint16_t color_565 = 0; if (index == 0) {