From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933649AbcKWWTp (ORCPT ); Wed, 23 Nov 2016 17:19:45 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:35537 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbcKWWTo (ORCPT ); Wed, 23 Nov 2016 17:19:44 -0500 Date: Thu, 24 Nov 2016 01:19:08 +0300 From: Dan Carpenter To: Thomas Gleixner , Mike Travis Cc: Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Dimitri Sivanich , Nathan Zimmer , Alex Thorlton , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] x86/apic/uv: silence a shift wrapping warning Message-ID: <20161123221908.GA23997@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org m_io is stored in 6 bits so it's a number in the 0-63 range. Static analysis tools complain that 1 << 63 will wrap so I have changed it to 1ULL << m_io. This code is over three years old so presumably the bug doesn't happen very frequently in real life or someone would have complained by now. Fixes: b15cc4a12bed ("x86, uv, uv3: Update x2apic Support for SGI UV3") Signed-off-by: Dan Carpenter --- Please review this one, carefully because I'm not positive about it. diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index aeef53c..35690a1 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -815,9 +815,9 @@ static __init void map_mmioh_high_uv3(int index, int min_pnode, int max_pnode) l = li; } addr1 = (base << shift) + - f * (unsigned long)(1 << m_io); + f * (1ULL << m_io); addr2 = (base << shift) + - (l + 1) * (unsigned long)(1 << m_io); + (l + 1) * (1ULL << m_io); pr_info("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n", id, fi, li, lnasid, addr1, addr2); if (max_io < l)