From patchwork Fri Apr 14 09:40:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stanislav Kinsburskii X-Patchwork-Id: 86513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1377121vqo; Fri, 21 Apr 2023 15:32:57 -0700 (PDT) X-Google-Smtp-Source: AKy350aPAdGPX/v3TkD9YelSXpItUAFu4lrMU3jCgsy/robJ/bIBW/b/xrkpd/lhWydMpwl+98Gf X-Received: by 2002:a05:6a00:1996:b0:5e0:a86:a76f with SMTP id d22-20020a056a00199600b005e00a86a76fmr8944118pfl.0.1682116377543; Fri, 21 Apr 2023 15:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682116377; cv=none; d=google.com; s=arc-20160816; b=DIdvImyyLTac6k+R66f0H3E0eewQnBYNCJ8UnRcXFNFjfQ38SwqPlTatXzDGt4x3NW xIigrmbsXU9YbxWTnXRhXVf7g7oK/deyc3azsPjbC+5mjcyM9EpLzgQ4TmCuClovqJqp SPld55z/aDZ1EYLUeHWSe93kY7PcOu/BTgx4o8Ql1/IfbwGTrvnEl2+UdfyIAdL+Bh+9 3uM49jwOamOSYJcYylpTslcO2b40piDH199efvRKt8Y2H//orKnQJvrdD10IUo/30Btx N6ibi+8w0c1b8duE7RXN2M8NQLa8OcFfoFlBDu/2V6gI5i2Mh3DXSqm+iBvACyguokkX dITg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a63db44000000b0051bb415165dsi1967763pgi.194.2023.04.21.15.32.44; Fri, 21 Apr 2023 15:32:57 -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 S233554AbjDUW3a (ORCPT + 99 others); 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763826862324598280?= X-GMAIL-MSGID: =?utf-8?q?1763826862324598280?= 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); }