From patchwork Sat Apr 13 02:28:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yipeng Zou X-Patchwork-Id: 13628599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC3C4C4345F for ; Sat, 13 Apr 2024 02:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=59KgzFcgBnjOME3v+XQXqgwPPjwq2G201QRb4UCUa4k=; b=aA71Onu/2ZxnC3 leF6OfoARsG1zOMWXvUbRSyUwCrlGSko9pO8n/qGnQC+ChN57G93C81USyhl0zMWSCS9S+gRf4BS4 AI1pGbDKxhXogwJH57bmpKjmc0HWqyCNUv6mgomXdV75NkLe3rNBInbFcR68YtYUwtmCv2OtytR+q wL1mLcJckQ86H2r0IzkDpHXRgF20mQePY/ZTkrM2wDra+gIQPPtInUouhUwhUlGS6NeRi9B/asCIo 1dWQjAUnFaUYdXy9Ibw1Pj04RwdcMJ+EBmQtJQUWCX36AtddxvvMT3iYSeRLSt4Qt6HPxoFMR795V y5/KnqYwhf1LjmorU7JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvT8c-000000025ee-3LBP; Sat, 13 Apr 2024 02:29:06 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvT8Y-000000025dX-2WMc for linux-arm-kernel@lists.infradead.org; Sat, 13 Apr 2024 02:29:04 +0000 Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VGckS6QXwz1ynTB; Sat, 13 Apr 2024 10:26:24 +0800 (CST) Received: from canpemm500008.china.huawei.com (unknown [7.192.105.151]) by mail.maildlp.com (Postfix) with ESMTPS id 7859A1402CE; Sat, 13 Apr 2024 10:28:43 +0800 (CST) Received: from huawei.com (10.90.53.73) by canpemm500008.china.huawei.com (7.192.105.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sat, 13 Apr 2024 10:28:43 +0800 From: Yipeng Zou To: , , , , , , , CC: Subject: [PATCH v3] arm: fix clang build warning in include/asm/memory.h Date: Sat, 13 Apr 2024 10:28:43 +0800 Message-ID: <20240413022843.1730174-1-zouyipeng@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500008.china.huawei.com (7.192.105.151) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_192902_856406_B86116D3 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. 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 There is a build error has been founded with build in clang-15.0.4: ./arch/arm/include/asm/memory.h:358:12: error: result of comparison "phys addr_t’ (aka 'unsigned int’) > 4294967295 is always false [-Werror, -Wtautological-type-limit-compare] if (addr > (u32)~0) ~~~~ ^ ~~~~~~~ It will be always goes fail without CONFIG_PHYS_ADDR_T_64BIT. Directly silence it by Use CONFIG_PHYS_ADDR_T_64BIT. Fixes: 981b6714dbd2 ("ARM: provide improved virt_to_idmap() functionality") Signed-off-by: Yipeng Zou Reviewed-by: Nathan Chancellor Reviewed-by: Linus Walleij --- arch/arm/include/asm/memory.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index ef2aa79ece5a..a7973eb8cbc7 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef CONFIG_NEED_MACH_MEMORY_H #include @@ -353,8 +354,10 @@ static inline unsigned long phys_to_idmap(phys_addr_t addr) { if (IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset) { addr += arch_phys_to_idmap_offset; - if (addr > (u32)~0) +#ifdef CONFIG_PHYS_ADDR_T_64BIT + if (addr > U32_MAX) addr = IDMAP_INVALID_ADDR; +#endif } return addr; }