From patchwork Tue Mar 23 13:18:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12157843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BA55C433DB for ; Tue, 23 Mar 2021 13:20:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A28561878 for ; Tue, 23 Mar 2021 13:20:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A28561878 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=d/sSSW5dRTFrdSnFyFSZE4Bqoa2OEF+shJ5rFRU6Dys=; b=AN4l4B6I2DQ79iEB2Prnx5+c10 9vwi8/3xv4ICRCy80020WqtgzByWAikenES5hmV9lolSy3dJZUW0g19OgEzF27Lemxg361oz9fwM4 D8s8XGMk9aq/x1n4uIvNd3oXaFrM8mtgi4mxrgiDpvRSfR9FlVvHCkDT8zf5PIL1AnQbExBKQ2+Ul 3iR8GfopAT6KmMOcYM+8Fql/Jwsoa1JzXDtQ5spMHFu9kLKMX1pSrCwfUNLYmGVSBIGuQuN+cXEBJ 2ddcyPNB6nYzkiHce0RKtbI++BvhkNVhQZrErw3Hni+Z/p8djTIX/c39+FnLk6xSQUAM5r+CB97dW gw4NRIOg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOgvR-00F1qw-Bt; Tue, 23 Mar 2021 13:18:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOgvM-00F1qR-WC for linux-arm-kernel@lists.infradead.org; Tue, 23 Mar 2021 13:18:23 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E26CF619BD; Tue, 23 Mar 2021 13:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616505499; bh=zy3eaWM34meh9vujn/0cgSKa8LyiHHrxZT/dC6isFBM=; h=From:To:List-Id:Cc:Subject:Date:From; b=o38ISwQi98tv0l8IqjPmKf4oQ6BexixE8XCwsQUYxsIMQLYon8hs+kbtz6YCwtVeo PIQCuwk2i55hdzSNiRtNz9Yf//2sCizxpelNSFKua3drsM3mtB1hKq2q/XJtLVORU+ l8M4df1LF3q/wkb4zbYhj4vCAHDS9V6YliWKN+2JjBVgA9fEw8tY+DYczi9fYPYtuI H5sYhlqqzMeGeXpab646/elVcqy1bXKNFBrFeb8byLP75oAPsygl8kxd1ym0HgH+lF 5LHPli2sJBV9HJym6fM9gDrmTazynbQCLtHUj6Ao6ZzofxG7KGJOgB4tA9Q3kKgPdo HqsyUwxMVBxdA== From: Arnd Bergmann To: Santosh Shilimkar , Nathan Chancellor , Nick Desaulniers List-Id: Cc: soc@kernel.org, Arnd Bergmann , Russell King , Robin Murphy , Mathieu Poirier , Jim Quinlan , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ARM: keystone: fix integer overflow warning Date: Tue, 23 Mar 2021 14:18:05 +0100 Message-Id: <20210323131814.2751750-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_131821_571263_1A26B2EE X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann clang warns about an impossible condition when building with 32-bit phys_addr_t: arch/arm/mach-keystone/keystone.c:79:16: error: result of comparison of constant 51539607551 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] mem_end > KEYSTONE_HIGH_PHYS_END) { ~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~ arch/arm/mach-keystone/keystone.c:78:16: error: result of comparison of constant 34359738368 with expression of type 'phys_addr_t' (aka 'unsigned int') is always true [-Werror,-Wtautological-constant-out-of-range-compare] if (mem_start < KEYSTONE_HIGH_PHYS_START || ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~ Change the temporary variable to a fixed-size u64 to avoid the warning. Signed-off-by: Arnd Bergmann Acked-by: Santosh Shilimkar Reviewed-by: Nathan Chancellor --- arch/arm/mach-keystone/keystone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index cd711bfc591f..2c647bdf8d25 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -65,7 +65,7 @@ static void __init keystone_init(void) static long long __init keystone_pv_fixup(void) { long long offset; - phys_addr_t mem_start, mem_end; + u64 mem_start, mem_end; mem_start = memblock_start_of_DRAM(); mem_end = memblock_end_of_DRAM(); @@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void) if (mem_start < KEYSTONE_HIGH_PHYS_START || mem_end > KEYSTONE_HIGH_PHYS_END) { pr_crit("Invalid address space for memory (%08llx-%08llx)\n", - (u64)mem_start, (u64)mem_end); + mem_start, mem_end); return 0; }