From patchwork Thu Mar 27 15:28:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 27231 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E974202FA for ; Thu, 27 Mar 2014 16:51:18 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf13486101obc.2 for ; Thu, 27 Mar 2014 09:51:17 -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=Nj4L6VjNEGBuPv82BBp6gtHU5pX3J1xkBzZ/AcpNW3I=; b=d51FOf5dZrgKxTKL0FEZPRxbbbPYJYSGFnGo1+qrWxlN41k/GdvpVV4V1v8/i7jNhX kR6Y2Y+D92jpcC0WNMy1VKjMCyjyZ4rb4m4YlozaolyEOBzzXDOQGsbkjc/VSWZormXC huw1kCvYhqFmjx70T/2dJnHCQZCY3wT9FJqRbsxuhYV1m4YaDWMljJs1sHxsg9ot6JHR iXfLiBzw5l+kjZcpxtHse164EXFZMpeZv8lXh/afrmx3XSOwriBmJaH2FTd+V3tTOKll 13c5M9Oely+5gRDnx/7Iy0DC2+7S7Yquazls6GhrB8jUHoDOvqRPUQfHrAITvgEXodKR rl+w== X-Gm-Message-State: ALoCoQmyXhhag8RTjhz5WHoNokSMYGXe2mpa13EZZdLOw2Siyi1SS0N8tPrNOchDqekc6CAYyisO X-Received: by 10.182.230.168 with SMTP id sz8mr1108730obc.9.1395939077820; Thu, 27 Mar 2014 09:51:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.16 with SMTP id g16ls1143884qgd.25.gmail; Thu, 27 Mar 2014 09:51:17 -0700 (PDT) X-Received: by 10.220.147.16 with SMTP id j16mr2329499vcv.14.1395939077688; Thu, 27 Mar 2014 09:51:17 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id f9si579142vck.145.2014.03.27.09.51.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 09:51:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so1281509veb.16 for ; Thu, 27 Mar 2014 09:51:17 -0700 (PDT) X-Received: by 10.58.37.232 with SMTP id b8mr2305253vek.27.1395939077600; Thu, 27 Mar 2014 09:51:17 -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 i9csp43522vck; Thu, 27 Mar 2014 09:51:17 -0700 (PDT) X-Received: by 10.140.20.167 with SMTP id 36mr3304101qgj.54.1395939077010; Thu, 27 Mar 2014 09:51:17 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x1si1312178qcn.9.2014.03.27.09.51.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 27 Mar 2014 09:51:17 -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]:54958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTDWO-00042D-LJ for patch@linaro.org; Thu, 27 Mar 2014 12:51:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTDTT-0007dU-8c for qemu-devel@nongnu.org; Thu, 27 Mar 2014 12:48:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTDTH-0006UC-QN for qemu-devel@nongnu.org; Thu, 27 Mar 2014 12:48:15 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:47372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTDTH-0006TQ-I1; Thu, 27 Mar 2014 12:48:03 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3A6194373E; Thu, 27 Mar 2014 20:48:02 +0400 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 25A4F683; Thu, 27 Mar 2014 19:28:35 +0400 (MSK) Received: (nullmailer pid 1788 invoked by uid 1000); Thu, 27 Mar 2014 15:28:30 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Thu, 27 Mar 2014 19:28:16 +0400 Message-Id: <1395934108-1694-12-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395934108-1694-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1395934108-1694-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Peter Maydell , Michael Tokarev Subject: [Qemu-devel] [PULL 11/23] hw/intc/apic.c: Use uint32_t for mask word in foreach_apic 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: mjt@tls.msk.ru X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Maydell 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 Signed-off-by: Michael Tokarev --- 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;\