From patchwork Mon Mar 17 16:00:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 26394 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C9F020143 for ; Mon, 17 Mar 2014 16:02:15 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id hl1sf10263565igb.0 for ; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=axMg+qZzEKZ3NJZogDWXkr6VXoMANmaM3lCLpA1AHUI=; b=PSKA6MGCJXwKfb5g3igJFBTUQ8CMDRyVzXGNQS5L1YIRDKppRgMVEq0yUPf2zkWWjH dciVPDPhzKPeVCFDjjQ372xhOZHh4XrPluNn2efmZhOaAIi9tSVNZuzUtPU+sawKDVW3 LkU3m4irDFRiX26bSs/O1fcuNeOJF11ItjsSIUsCFErW4xk6MNLVelJqD59iokYRO9uK H+PBXR1lSZ2VycQFA8ZVCim53P1LdVHRWUXpB92xApZ5frifpUFQFtpLs4wHg+904FJA TXeZkIvJJiyzApQe+3pNPb4bIj0DEo2JwFYarHUC79UalC1Zl3QYr4Du0vri/DpZNt5A dBEg== X-Gm-Message-State: ALoCoQmFELkVsGP727ZbqASeMAnWpIOL64hqEr6L4cUwVGyyfV3u4u5DI1gZFnYiemuSjEXhHO1Y X-Received: by 10.182.219.226 with SMTP id pr2mr9349848obc.44.1395072134842; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.203 with SMTP id t69ls1764906qgd.87.gmail; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) X-Received: by 10.221.73.73 with SMTP id yr9mr14869vcb.76.1395072134700; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id yw3si5416950vcb.39.2014.03.17.09.02.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Mar 2014 09:02:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id id10so6094265vcb.12 for ; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr2397971vcb.24.1395072134621; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp137657vck; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) X-Received: by 10.140.32.162 with SMTP id h31mr27656745qgh.49.1395072134082; Mon, 17 Mar 2014 09:02:14 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q42si7578080qga.31.2014.03.17.09.02.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 17 Mar 2014 09:02:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:58737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPZzR-0007Ql-DO for patch@linaro.org; Mon, 17 Mar 2014 12:02:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPZy3-0005Ea-Lt for qemu-devel@nongnu.org; Mon, 17 Mar 2014 12:00:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPZy0-0007hG-Rl for qemu-devel@nongnu.org; Mon, 17 Mar 2014 12:00:47 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:46882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPZy0-0007gB-42; Mon, 17 Mar 2014 12:00:44 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WPZxx-0004wW-LU; Mon, 17 Mar 2014 16:00:41 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 17 Mar 2014 16:00:40 +0000 Message-Id: <1395072041-18911-12-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395072041-18911-1-git-send-email-peter.maydell@linaro.org> References: <1395072041-18911-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: qemu-trivial@nongnu.org, qemu-ppc@nongnu.org, patches@linaro.org Subject: [Qemu-devel] [PATCH v2 11/12] hw/intc/xilinx_intc: Avoid shifting left into sign bit 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Avoid undefined behaviour shifting left into the sign bit. Signed-off-by: Peter Maydell --- hw/intc/xilinx_intc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c index 4a10398..1b228ff 100644 --- a/hw/intc/xilinx_intc.c +++ b/hw/intc/xilinx_intc.c @@ -71,8 +71,9 @@ static void update_irq(struct xlx_pic *p) /* Update the vector register. */ for (i = 0; i < 32; i++) { - if (p->regs[R_IPR] & (1 << i)) + if (p->regs[R_IPR] & (1U << i)) { break; + } } if (i == 32) i = ~0;