From patchwork Wed Jul 10 13:04:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11038471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBDC313B1 for ; Wed, 10 Jul 2019 13:07:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE5902865F for ; Wed, 10 Jul 2019 13:07:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A234628725; Wed, 10 Jul 2019 13:07:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 527A22865F for ; Wed, 10 Jul 2019 13:07:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hlCHt-0003r3-OQ; Wed, 10 Jul 2019 13:05:33 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hlCHs-0003qy-Ei for xen-devel@lists.xenproject.org; Wed, 10 Jul 2019 13:05:32 +0000 X-Inumbo-ID: 64a4bbb2-a313-11e9-8a11-dbe6be82b395 Received: from mout.kundenserver.de (unknown [212.227.126.134]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 64a4bbb2-a313-11e9-8a11-dbe6be82b395; Wed, 10 Jul 2019 13:05:30 +0000 (UTC) Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MG9To-1hhtRC0cVY-00GcBk; Wed, 10 Jul 2019 15:05:26 +0200 From: Arnd Bergmann To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Date: Wed, 10 Jul 2019 15:04:55 +0200 Message-Id: <20190710130522.1802800-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:P4mHzcBPHXgdb+u5vlx/hBpSw2l3rZVeWH9UqWEV1mEVmDpXjqc JcS1nDm3cY6uP95lhZ6OmZV9FXhTFdBefNhUFcM/YEx5wWSzK7UfL3fNZdvXYsaVnlt9ygM oKo/NnHEx3zlZHa4vlzc9lXYhaGTlnESjypQx81UC210Q/dZBFOr0Q0XPSD9rlqhryzD441 NW8eQsCEheKKtMQjTPZRQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:PZw3USf94/I=:M+icLSClyqLKdVhhCZubUA 47jMTB4X8usjv8TaYgEmQHpWE1BGOo3gIbWMniuwY6yrjFjrglYMQbHIczZGTE9wc20s5+WSX 81FFnw9MOZNvgdOrqFVuaTFOTXsKtCX9O52Gki/NToZ8/oyF4UZ/kh+uukfTcfq9BoBK/Bpdy AqQS5iSX3IvX9IMIf/QGTqPLMueDp3CQTo45P4Cp/7f3corWdKda00qH0EAnepwIyZp25zDpA bcOdI41sbabP3BVOYAwiup6Ig2fofbnUZ3r5NZ53XVkvpzZyClqKSTrsaApXIEab9hEvy/fML phIDyU5uxy5PsKZP2t0ZsQqTAWvlcfWXLZFfNhrNs9Ftkh5ncAPAeeIF3WBcZhrn3GnNIF2UC 30Di1xjdKPuArGNV67oc5Ep/TtCFVxQgKhDSmIyNFx6/1Rvpw1dI6S5d7DF+v2NenNOec13UR g1bOQkXbwTzif1Zm8ytGOT0CPYld/GSsYUw1qlLY/sqhPBdFgX7j3g4kr7Ly+PFSnwK/LJxOo /5DStVTJAk2IJM2FbtI4wnpSV9ha2JytHOOO42NObZI/8v5pIE8aMxlRXcOJ6GzwrqE68uu+B tP5fFDmgsv1d3euocNJoIyDQ31evYwwZpl0AdTWgZlezZkrkQLGJMsJJPWfcfmgGpmp+x/SSm hAhw2yQiaplzkzTD+bs71xFgaGVTCW1oYeMCo3wsh9bp3/XWFAcq88FDfpBqtB5aoeUQ7/PhD pdqUkdJq1q7Y7bIbz7DEZRnRPYtezbWMXhbDPg== Subject: [Xen-devel] [PATCH] x86: fix LOWMEM_PAGES constant X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Joerg Roedel , Denys Vlasenko , Arnd Bergmann , clang-built-linux@googlegroups.com, Peter Zijlstra , Brian Gerst , Josh Poimboeuf , linux-kernel@vger.kernel.org, matt@codeblueprint.co.uk, Andy Lutomirski , "H. Peter Anvin" , xen-devel@lists.xenproject.org, Boris Ostrovsky , Linus Torvalds , Ingo Molnar Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP clang points out that the computation of LOWMEM_PAGES causes a signed integer overflow on 32-bit x86: arch/x86/kernel/head32.c:83:20: error: signed shift result (0x100000000) requires 34 bits to represent, but 'int' only has 32 bits [-Werror,-Wshift-overflow] (PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT); ^~~~~~~~~~~~ arch/x86/include/asm/pgtable_32.h:109:27: note: expanded from macro 'LOWMEM_PAGES' #define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT)) ~^ ~~ arch/x86/include/asm/pgtable_32.h:98:34: note: expanded from macro 'PAGE_TABLE_SIZE' #define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD) Use the _ULL() macro to make it a 64-bit constant. Fixes: 1e620f9b23e5 ("x86/boot/32: Convert the 32-bit pgtable setup code from assembly to C") Signed-off-by: Arnd Bergmann --- arch/x86/include/asm/pgtable_32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h index 4fe9e7fc74d3..c78da8eda8f2 100644 --- a/arch/x86/include/asm/pgtable_32.h +++ b/arch/x86/include/asm/pgtable_32.h @@ -106,6 +106,6 @@ do { \ * with only a host target support using a 32-bit type for internal * representation. */ -#define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT)) +#define LOWMEM_PAGES ((((_ULL(2)<<31) - __PAGE_OFFSET) >> PAGE_SHIFT)) #endif /* _ASM_X86_PGTABLE_32_H */