Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1416479pxp; Sun, 20 Mar 2022 16:43:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO6lVb167Aq8tGo1PlkQanBg3Ker11CIrBYzHJs6fLXcJ+DltTCFMWdzb6mpZHiS2eqvxs X-Received: by 2002:a17:90b:3a8a:b0:1c6:47fe:c9b0 with SMTP id om10-20020a17090b3a8a00b001c647fec9b0mr23013336pjb.151.1647819782923; Sun, 20 Mar 2022 16:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647819782; cv=none; d=google.com; s=arc-20160816; b=QGubCcAIwFa0w849pOig6qtqK4ub7uq/0DuqUIvenYhP+R9np0EZQ17MYe+emy2ltr Sqs5rEsxEW0jRpKe1SHnA+2YFGpjUYAvqTIs+u4bfoGFyqY/MRNqxQD6z5Ja8W6i+phV dcLrtAPTnUw5A1hDj9s1TpBo2nBhtHsrWeOGgozzztm0jTiX2tG0oR2ndDQYOBEUJIJZ Kd9XucM7I6PGSDyuYl7AE5wNPVhpZgiumbSsJGOAyIq1QeJ2JGCnjhLFLtI56HgkbYrU tF7guIiODwX/ep8f0rKUSv0W/G/9eC9nniUdjQrKd4sEraX4tTx43MPbL32b4lCwuzhp i/XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=vgHRAaQ3IGGMU+xYHihsF9+383Tt5u+vLF53flSJOuk=; b=xkGyG3Ou7Xx5QM6ZnVpa55mNjf7dmeFbgaqEud5ASgSH20Qo5ISuQ9NEicW8Fpdhyl ES/ZqzgYXaxmKW1/9IEoPYQ+4cg8/Tr+RuzK62De/2G9f8oYAYrHzitj82Y2mYA0EWgt ra5Ejcbnko9wmqd421FZF7QgDBmh5Qnks4OsjeedACfvsvXrB3Kmew9rf3/1PUsVFJKg Srad16O5J/jQGUXfE1UbTczvrDTQ0EM43BJdeIx47yP6ZRLD/MHGoaQiyq+wND9mU36k YK3/dzrukFNVYSFiu0/tyCaA7GXMul+0I24wbr9i5R3TkazhmzQt4KahYrrMSo72jmqt U8YA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp2-20020a17090b190200b001c6c4431f41si6951350pjb.82.2022.03.20.16.42.49; Sun, 20 Mar 2022 16:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240297AbiCRTNH (ORCPT + 99 others); Fri, 18 Mar 2022 15:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233464AbiCRTNH (ORCPT ); Fri, 18 Mar 2022 15:13:07 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E47D0247C2C for ; Fri, 18 Mar 2022 12:11:46 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3DB2111FB; Fri, 18 Mar 2022 12:11:46 -0700 (PDT) Received: from [10.57.43.230] (unknown [10.57.43.230]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 716A13F766; Fri, 18 Mar 2022 12:11:44 -0700 (PDT) Message-ID: <3b9cedd6-a084-5d87-2fdd-0da10146827b@arm.com> Date: Fri, 18 Mar 2022 19:11:39 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS Content-Language: en-GB To: Arnd Bergmann , Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , James Morse Cc: Arnd Bergmann , "Russell King (Oracle)" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev References: <20220316183833.1563139-1-arnd@kernel.org> From: Robin Murphy In-Reply-To: <20220316183833.1563139-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-03-16 18:38, Arnd Bergmann wrote: > From: Arnd Bergmann > > The newly introduced TRAMP_VALIAS definition causes a build warning > with clang-14: > > arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic] Tangentially, all the other GNU extensions we depend on throughout Linux are also GNU extensions. Do we know what's special about this one? Robin. > return (char *)TRAMP_VALIAS + SZ_2K * slot; > > Change the addition to something clang does not complain about. > > Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1") > Signed-off-by: Arnd Bergmann > --- > arch/arm64/include/asm/vectors.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > I see this warning on 5.17-rc8, but did not test it on linux-next, > which may already have a fix. > > diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h > index f64613a96d53..bc9a2145f419 100644 > --- a/arch/arm64/include/asm/vectors.h > +++ b/arch/arm64/include/asm/vectors.h > @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors { > DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector); > > #ifndef CONFIG_UNMAP_KERNEL_AT_EL0 > -#define TRAMP_VALIAS 0 > +#define TRAMP_VALIAS 0ul > #endif > > static inline const char * > arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot) > { > if (arm64_kernel_unmapped_at_el0()) > - return (char *)TRAMP_VALIAS + SZ_2K * slot; > + return (char *)(TRAMP_VALIAS + SZ_2K * slot); > > WARN_ON_ONCE(slot == EL1_VECTOR_KPTI); >