From patchwork Mon Mar 17 16:00:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 26400 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8BB0120143 for ; Mon, 17 Mar 2014 16:26:56 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq10sf10373064igb.1 for ; Mon, 17 Mar 2014 09:26:56 -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=kLBNHJFIKQuV5fAgKRC4viLejV1wslD8h+652brU4wg=; b=aKAAKmGBHNdTxAHsXd99OjzurIMLi5W+zK+3nCyPVsQZ7+7Cbov1PH3rGo8x2qciTL QuRZOod3kYKl3bXvkFI8Tl5iwp8t2xA4yHqcW2gyM+/aJv0VDPebwI2Qxr5GkpQzWtu8 dr0pasr/shuGVvWMRj83GgsQ/nmJXO7wVliAQ/faFtIEX0WHxaMZO4e1eNCShD49AReu s3E+0a6ZSx2GS/iD6n5AMrVISEhwpAz75IoHc9eeBxldfNEzpcwA/UuAk36iwjCqzIy+ ozY25TrcsGP/1v4Ob1A9P08eJRW7pdCQiFHLpv/XFZgDZqf+o0SsNUZknQ2ZauOpHGsu TYgw== X-Gm-Message-State: ALoCoQn36RU4waePx9SR2zRNBOyyF40zuHIC8Q/ih84CjWHtGGL0KQNCf+hW7/seYzm9hCy/SJgn X-Received: by 10.42.123.66 with SMTP id q2mr7885638icr.16.1395073616003; Mon, 17 Mar 2014 09:26:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.50 with SMTP id l47ls1696410qga.49.gmail; Mon, 17 Mar 2014 09:26:55 -0700 (PDT) X-Received: by 10.221.27.136 with SMTP id rq8mr69756vcb.73.1395073615855; Mon, 17 Mar 2014 09:26:55 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id sv2si1891065vdc.129.2014.03.17.09.26.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Mar 2014 09:26:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 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.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so5971546vcb.2 for ; Mon, 17 Mar 2014 09:26:55 -0700 (PDT) X-Received: by 10.52.38.5 with SMTP id c5mr60641vdk.85.1395073615755; Mon, 17 Mar 2014 09:26:55 -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 i9csp139326vck; Mon, 17 Mar 2014 09:26:55 -0700 (PDT) X-Received: by 10.180.103.227 with SMTP id fz3mr10353512wib.29.1395073614259; Mon, 17 Mar 2014 09:26:54 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id fy2si5389139wib.56.2014.03.17.09.26.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 17 Mar 2014 09:26:54 -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 1WPZxx-0004vb-5N; Mon, 17 Mar 2014 16:00:41 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 02/12] hw/intc/apic.c: Use uint32_t for mask word in foreach_apic Date: Mon, 17 Mar 2014 16:00:31 +0000 Message-Id: <1395072041-18911-3-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-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.171 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 --- I took Stefan Weil's suggestion and merged the __mask declaration into the assignment inside the loop. --- hw/intc/apic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 361ae90..b8c061b 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -201,12 +201,12 @@ static void apic_external_nmi(APICCommonState *s) #define foreach_apic(apic, deliver_bitmask, code) \ {\ - int __i, __j, __mask;\ + int __i, __j;\ for(__i = 0; __i < MAX_APIC_WORDS; __i++) {\ - __mask = deliver_bitmask[__i];\ + uint32_t __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;\