Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2850673rwr; Fri, 21 Apr 2023 15:32:41 -0700 (PDT) X-Google-Smtp-Source: AKy350a+zU7WyPHpWcy/xOYpClkxa9jTCHJPmaRLAJEWRaq08j9p2y7+/Mytw3w0y1FKUWokuZJ5 X-Received: by 2002:a05:6a21:3384:b0:f0:251f:f099 with SMTP id yy4-20020a056a21338400b000f0251ff099mr8907204pzb.1.1682116361162; Fri, 21 Apr 2023 15:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682116361; cv=none; d=google.com; s=arc-20160816; b=BJogWn/mrIE9wXYjN2XwARjevzryaisrb/IgUiEaEAkOjgsliSePINFShl4iqqSO8c 8fGrJprVtx+RwZGsSBxMgIhTN1VtOWojfDBgpQ9VObAc6miFiBGsigDco6ysu9OUZ+qM EmCRRppWBFivvLAMLk6sOiYt4cXUR36rS12QQ1frFHLHvUV7GfqGofYSGxvIYu2st9Lw HxlEAhLqaVvYTB/pPxJSgcl+p192H2iFS5U82LXOgdkTp2wIlTZ20UhaAW8pGx0DOBc5 67TxGRpwtTOWFU2nagBQ/LCTGx/GVFNsVBMIgx6AhRchEqE83mlWS/1BIZCAyTKBq0Pf Q+vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:from:subject:dkim-signature :dkim-filter; bh=XSS94wog701zQLpD7y0CmSI6sjOskvST2v9WTZpXSuw=; b=JCrGA95JAxpSiZRNPJyvnMoqEJE6R34UUrOljJpuaIBlRG7ZMfdIhS5G+YS6zn62cl 5FT1cRDFjnRUBpPJNHA+i3HHkqHixYgv62TWEIA3OCMFelBbzNiUm0XrN22ZXRGeujd/ Vgycu1AEP1tjMow2jBHuQMjnLlumHvghhcY/KUNT7N55W5d9HT17HsMFmDhXQ44zCq5R al75F7UsQf7WKOWcZx7Iv+Fh1uluorbmhHrf3KoRFrUUIvQ6NaHAPY8bxYk7/erpysGD mD7mRoxlEWEs8TfG2wb9V618jFy3oVmURMYj7gj1Ib/WXvswUUMVnoX3P96omp2v3OlM zw+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=arEPHrKs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 197-20020a6306ce000000b0050bf5b9ad11si1197055pgg.752.2023.04.21.15.32.28; Fri, 21 Apr 2023 15:32:41 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=arEPHrKs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233536AbjDUW33 (ORCPT + 99 others); Fri, 21 Apr 2023 18:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjDUW32 (ORCPT ); Fri, 21 Apr 2023 18:29:28 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8604D1BF0 for ; Fri, 21 Apr 2023 15:29:27 -0700 (PDT) Received: from skinsburskii.localdomain (c-67-170-100-148.hsd1.wa.comcast.net [67.170.100.148]) by linux.microsoft.com (Postfix) with ESMTPSA id 26EF021C2533; Fri, 21 Apr 2023 15:29:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 26EF021C2533 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682116165; bh=XSS94wog701zQLpD7y0CmSI6sjOskvST2v9WTZpXSuw=; h=Subject:From:Cc:Date:From; b=arEPHrKsh8TFGu/P0XgGPHT9pjeBHzdkoVeqO526rGC7zm/U3vt4SRxnWYpvHdhQh SSPIer8A5yVObP4y3b3+TKOhosxNDOSpBkhp2MxR/XdsDcmXFkNPOms7g3w/3rIMIn 1bWpAuyXCGq5DHAzh+bopglKFWnST9ompseG90EQ= Subject: [PATCH] x86: asm/io.h: Harden virt_to_phys/isa_virt_to_bus prototypes From: Stanislav Kinsburskii Cc: Stanislav Kinsburskii , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Geert Uytterhoeven , Arnd Bergmann , Chris Down , Helge Deller , Omar Sandoval , linux-kernel@vger.kernel.org Date: Fri, 14 Apr 2023 02:40:34 -0700 Message-ID: <168146523405.6279.3632248068235163346.stgit@skinsburskii.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-15.4 required=5.0 tests=BAYES_00,DATE_IN_PAST_96_XX, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH, MISSING_HEADERS,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanislav Kinsburskii These two helper functions - virt_to_phys and isa_virt_to_bus - don't need the address pointer to be mutable. In the same time expecting it to be mutable leads to the following build warning for constant pointers: warning: passing argument 1 of ‘virt_to_phys’ discards ‘const’ qualifier from pointer target type Signed-off-by: Stanislav Kinsburskii CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: Dave Hansen CC: x86@kernel.org CC: "H. Peter Anvin" CC: Geert Uytterhoeven CC: Arnd Bergmann CC: Chris Down CC: Helge Deller CC: Omar Sandoval CC: linux-kernel@vger.kernel.org --- arch/x86/include/asm/io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index e9025640f634..0e6f5b48f517 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -128,7 +128,7 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); * this function */ -static inline phys_addr_t virt_to_phys(volatile void *address) +static inline phys_addr_t virt_to_phys(const volatile void *address) { return __pa(address); } @@ -163,7 +163,7 @@ static inline void *phys_to_virt(phys_addr_t address) * However, we truncate the address to unsigned int to avoid undesirable * promotions in legacy drivers. */ -static inline unsigned int isa_virt_to_bus(volatile void *address) +static inline unsigned int isa_virt_to_bus(const volatile void *address) { return (unsigned int)virt_to_phys(address); }