From patchwork Wed Aug 2 22:51:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 9877847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4BA960390 for ; Wed, 2 Aug 2017 22:54:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B922727EE2 for ; Wed, 2 Aug 2017 22:54:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE04627C05; Wed, 2 Aug 2017 22:54:00 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D1B927A98 for ; Wed, 2 Aug 2017 22:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Bb5cO1D0DTXv83SbS2LIJLO/lBVOiHHBwhXbahaYcFo=; b=j33nLK1O3pY/lAih2g5lsIkS4W cNWUrvdYGZBM5SuPWo8rc4ykYyvW5FMq7x6smpaAhC3No0y9xy6xOLjeEL/dWGLmTDbkcRiIJuw2G MrySwoF78TI+XSuUhq0Xo7uGA2MPIjhBBPtl97Um+JJPe5E3wl6BGf2iylq5xDw3z8BdmMzPZMZJH 7O9ZUv3pdYxBPhWSXxYPjsS7aTxKZaKAIY6MBqTOwUJSTosVaBL2DayOy9j9THtFQXiueU69QNJk0 PysRNEUvyd/Umy9Ug55QwR37clPe3BlxfW/HsS2uA1W9QoB5rxYFEUjqSnRc/7f1tsSVdaXE64tCJ oBll+X1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dd2Vv-000144-Lr; Wed, 02 Aug 2017 22:53:15 +0000 Received: from mail-pg0-f42.google.com ([74.125.83.42]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dd2Vo-0000mp-RC for linux-arm-kernel@lists.infradead.org; Wed, 02 Aug 2017 22:53:13 +0000 Received: by mail-pg0-f42.google.com with SMTP id y129so26666795pgy.4 for ; Wed, 02 Aug 2017 15:52:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IHC07FjNA3ZmH96pv+E7EXYWxjfLwwtIrK7fyRp4G5c=; b=HX8KhWZ4b3szsSRi9xSv7CWUc4DgogbaweBXVQX8PmvR4uEPzTewD9/NqgUCP+1sAd wutVPxxgM/jfXSp0eV8cjuJrJStEFV8Pp6sPCbtSi06r+47YQSFLPpdBz1h8ryyGh0hr p+1prsEiTTDl5rWR6iV8U+6p5vP8s66hVO5PgikCG2Qo0vMoPmqyT40szZ1Kj+bBP2kb JjtopBpgD7JU+yh3f1QnGUnvJqgNriVRg+jixS6eG/HJHD7qGZj3DAmMcwt1w1knpDrP 3x1KM2cq0GVMYJz7xJb+6E3lVqy79BSTLhtbZmUkjSjZQO9GPx8eBCCwu9LfqfP7K1xi LW6w== X-Gm-Message-State: AIVw112wLYO64+VXXvFM7rUOH5qSQnvtdabgRxLzINZkJfjuzWSlcxFq 0Nf/+96kOFC16K5o X-Received: by 10.98.212.27 with SMTP id a27mr24323073pfh.157.1501714367832; Wed, 02 Aug 2017 15:52:47 -0700 (PDT) Received: from mka.mtv.corp.google.com ([172.22.112.49]) by smtp.gmail.com with ESMTPSA id t17sm65412103pge.55.2017.08.02.15.52.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Aug 2017 15:52:47 -0700 (PDT) From: Matthias Kaehlcke To: zijun_hu , Andrew Morton , Catalin Marinas , Will Deacon , Mark Rutland , Laura Abbott Subject: [PATCH 2/2] arm64: Define PAGE_OFFSET using GENMASK_ULL Date: Wed, 2 Aug 2017 15:51:59 -0700 Message-Id: <20170802225159.159536-2-mka@chromium.org> X-Mailer: git-send-email 2.14.0.rc1.383.gd1ce394fe2-goog In-Reply-To: <20170802225159.159536-1-mka@chromium.org> References: <20170802225159.159536-1-mka@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170802_155309_359929_ADA3BCAB X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , linux-kernel@vger.kernel.org, Greg Hackmann , Doug Anderson , Matthias Kaehlcke , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As is the definition causes an integer overflow, which is expected, however clang raises the following warning: arch/arm64/kernel/head.S:47:8: warning: integer overflow in preprocessor expression #elif (PAGE_OFFSET & 0x1fffff) != 0 ^~~~~~~~~~~ arch/arm64/include/asm/memory.h:52:46: note: expanded from macro 'PAGE_OFFSET' #define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1)) ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~ Use GENMASK_ULL() instead of shifting explicitly, the macro takes care of avoiding the overflow. Reported-by: Nick Desaulniers Signed-off-by: Matthias Kaehlcke --- arch/arm64/include/asm/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 32f82723338a..732d4eed8edd 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -65,7 +65,7 @@ */ #define VA_BITS (CONFIG_ARM64_VA_BITS) #define VA_START (UL(0xffffffffffffffff) << VA_BITS) -#define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1)) +#define PAGE_OFFSET GENMASK_ULL(BITS_PER_LONG_LONG - 1, VA_BITS - 1) #define KIMAGE_VADDR (MODULES_END) #define MODULES_END (MODULES_VADDR + MODULES_VSIZE) #define MODULES_VADDR (VA_START + KASAN_SHADOW_SIZE)