From nobody Thu Dec 18 18:54:52 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C18FAC77B76 for ; Fri, 21 Apr 2023 22:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233600AbjDUW3a (ORCPT ); Fri, 21 Apr 2023 18:29:30 -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: quoted-printable 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 =E2=80=98virt_to_phys=E2=80=99 discards = =E2=80=98const=E2=80=99 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 */ =20 -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); }