From patchwork Mon Mar 10 19:10:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 26001 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 79DBA2054B for ; Mon, 10 Mar 2014 19:10:55 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id jt11sf19391699pbb.7 for ; Mon, 10 Mar 2014 12:10:54 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=NkkXruUREchYZJcukK53X37DomroDQCrSkwrmqfdeNA=; b=lzkqNtE4RuY+8K/oNpDXzpUBEVA8FexKpLsFiY6ImuTYD8DWP4jyJUH8IQkNeFAZI6 pOUx6yRY9y2yp22c7ciVliYIPTT87oLFUqlJL3nOt+9t85gM6H1aZTq/X4yT8Ndivvva FctONVdxmZC1QENpmE/jfGVOlNJsC7LstRe+jIiFCMhGAkzdYtAMuwRH5xMHznfwrDRp dLiKbxtgahb9ZSWgZiK4FkXbjA05PkrhXeYish2uc1GM/XobLGyZm/VMNeo4C5U9/hxV yak5L/ZjcOBhJgRtdC3ux3P0y2HcbQhAjNSozBLZuhxHMM8F4vkFbU0kxucrCfCv/8Al 5h6g== X-Gm-Message-State: ALoCoQnzm3D3QFkMWWKm2t678wExBBtqxmR1rZMktt5ETINBYXs6Zw1MuDIlELY459NNb59H5DGq X-Received: by 10.66.183.239 with SMTP id ep15mr14874637pac.7.1394478654413; Mon, 10 Mar 2014 12:10:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls2152051qgd.86.gmail; Mon, 10 Mar 2014 12:10:54 -0700 (PDT) X-Received: by 10.52.188.41 with SMTP id fx9mr23580977vdc.19.1394478654162; Mon, 10 Mar 2014 12:10:54 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id tt2si5688843vdc.139.2014.03.10.12.10.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Mar 2014 12:10:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id ks9so1536565vcb.13 for ; Mon, 10 Mar 2014 12:10:54 -0700 (PDT) X-Received: by 10.221.37.1 with SMTP id tc1mr1597205vcb.32.1394478654073; Mon, 10 Mar 2014 12:10:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.78.9 with SMTP id i9csp141951vck; Mon, 10 Mar 2014 12:10:53 -0700 (PDT) X-Received: by 10.112.154.202 with SMTP id vq10mr23205518lbb.3.1394478651200; Mon, 10 Mar 2014 12:10:51 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id z8si19302009lal.91.2014.03.10.12.10.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Mar 2014 12:10:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WN5b7-0002T3-3X; Mon, 10 Mar 2014 19:10:49 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH 02/12] hw/intc/apic.c: Use uint32_t for mask word in foreach_apic Date: Mon, 10 Mar 2014 19:10:38 +0000 Message-Id: <1394478649-9453-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1394478649-9453-1-git-send-email-peter.maydell@linaro.org> References: <1394478649-9453-1-git-send-email-peter.maydell@linaro.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.182 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use unsigned arithmetic for operations on the mask word in the foreach_apic() macro, to avoid relying on undefined behaviour when shifting into the sign bit. Signed-off-by: Peter Maydell Reviewed-by: Stefan Weil Reviewed-by: Michael S. Tsirkin --- hw/intc/apic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 361ae90..e137882 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -201,12 +201,13 @@ static void apic_external_nmi(APICCommonState *s) #define foreach_apic(apic, deliver_bitmask, code) \ {\ - int __i, __j, __mask;\ + int __i, __j;\ + uint32_t __mask;\ for(__i = 0; __i < MAX_APIC_WORDS; __i++) {\ __mask = deliver_bitmask[__i];\ if (__mask) {\ for(__j = 0; __j < 32; __j++) {\ - if (__mask & (1 << __j)) {\ + if (__mask & (1U << __j)) {\ apic = local_apics[__i * 32 + __j];\ if (apic) {\ code;\