From patchwork Mon Dec 12 19:35:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 32516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2429778wrr; Mon, 12 Dec 2022 11:38:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5u227EQw9PALfMPKPmej2f3lXAV3prlM3fQauREZX1n5pGzRGBfV6TSEk4rX+jdVul4Dmb X-Received: by 2002:a05:6a21:3383:b0:ad:5cde:8f05 with SMTP id yy3-20020a056a21338300b000ad5cde8f05mr14070827pzb.37.1670873895812; Mon, 12 Dec 2022 11:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670873895; cv=none; d=google.com; s=arc-20160816; b=ij2C2YfG4YA5yXCVT49qJvGi7sCkuKohjCg40OIX/uN0/KYeL3NR12Ckn/2lZlrVBD yVNhjCRMWeJnt4ZzuATVydpyewNH1rdFfeRrRcBVxAbj/iTGyVIqacBMLQU5rzdWxp60 mbwD2HMkcI/oggClMQOpRiGoBPFUczrPokZ9feBYmKgCK9e5W34XEXpiQP0w2eBkES1U zSrM9h1DCTbOFjYQj4amrRlY1iEy5QeXSWFH+cdin25eI2EZEHjGwEtUh9Dj7g/5WtsO g7zR1ddLwVkpmpPHunZgV5MU5XvBCMj2Zq4k8HnnEAQEYQDi7LsNNuC9Pe8xUUkYs/7n 5PZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=DA5RYlw5nSZ0avjZnRiKLuF+wuJ2XipiUUQcXPMg/bc=; b=E3Db+2eouE0fVIHGLAAJ7ciI0kjCFKvKGDZP2nTrKlwqrlY3gItfRa71OG+q8ehJL4 CsFyKiUcV2k3RJQb7CvgiPeMTCNAq3MIw7HA5z7PX34KVgCoF9pkMORWXqFPTlxlRS7Y ixucYahVCR3H6CKNXYSLb3LTV6vmaeDQaqUW1MYyC97kqMj97PYwRa+i+KatQjuq8xj5 ih2e9QT/1LOd5VlWVp9ZrIZBdzVZ+EQmgaTFCq/3ahW8v9uvZBKyzpj/MByHzjoeLr6n 1f7W8uRDlitHNZovCkWQmb9FZNpAaChkoViXtpC0D0qx4GSJCNGuv13GNbTF52Y62t/d u0PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KVO1ndTb; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=jxt2UHGK; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nn10-20020a17090b38ca00b00218d473a466si10697810pjb.160.2022.12.12.11.38.03; Mon, 12 Dec 2022 11:38:15 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=KVO1ndTb; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=jxt2UHGK; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbiLLTfi (ORCPT + 99 others); Mon, 12 Dec 2022 14:35:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232790AbiLLTff (ORCPT ); Mon, 12 Dec 2022 14:35:35 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B577D62CD; Mon, 12 Dec 2022 11:35:34 -0800 (PST) Date: Mon, 12 Dec 2022 19:35:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670873733; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DA5RYlw5nSZ0avjZnRiKLuF+wuJ2XipiUUQcXPMg/bc=; b=KVO1ndTbbVAgJjaL91xTgu4YqRyTglcJSuAi3zByPEmSfXWYkJ7KvGukeR8XbeQJL+oc7R 2TnSH6tqUKxrHHpFVyAJlcqZYBjbJ9hiI/40u1Jg+ZoLDI3KFaJeOKFG2TGgPTuRJMirtq 7x6WQY194fHBL5fyKeTai+AAs7QbE1clGYJBdv20oboWe7aNtOLhr8YO1SBZCh7xWx1pDq 9drRspRGvJbE3LKWj3THSM62I1QzfFYn6DMqnFxlGDE2BaiI8rhtJ9djS2jZPU0CFuzVnw a7P5yWWey81ro3DbmtTx2aZCGBezCZjsgmP13Eb2rt960XaxopNj87An3TIS6Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670873733; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DA5RYlw5nSZ0avjZnRiKLuF+wuJ2XipiUUQcXPMg/bc=; b=jxt2UHGKTL0P/ntko87iyt3B4RG7ozFlA+buqdGq4phzjGpnoDyZuonSyPr7O6VowYkosa en3U4ZuQI848FxBw== From: "tip-bot2 for Kirill A. Shutemov" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/mm: Fix sparse warnings in untagged_ptr() Cc: kernel test robot , "Kirill A. Shutemov" , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167087373271.4906.10859226256145693970.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752038266112559558?= X-GMAIL-MSGID: =?utf-8?q?1752038266112559558?= The following commit has been merged into the x86/mm branch of tip: Commit-ID: ce66a02538f39f071443bac9bc6ff8f3a780ab92 Gitweb: https://git.kernel.org/tip/ce66a02538f39f071443bac9bc6ff8f3a780ab92 Author: Kirill A. Shutemov AuthorDate: Wed, 16 Nov 2022 03:43:53 +03:00 Committer: Dave Hansen CommitterDate: Mon, 28 Nov 2022 15:12:25 -08:00 x86/mm: Fix sparse warnings in untagged_ptr() Linear Address Masking patchset triggered a lot of sparse warnings. The root cause is that casting pointer to '__typeof__(*(ptr)) *' will strip all sparse tags. The type has to be defined based on the pointer type, not based on what the pointer points to. Fix cast in untagged_ptr() and avoid __typeof__() usage in get/put_user(). Fixes: 5744534bdae4 ("x86/uaccess: Provide untagged_addr() and remove tags before address check") Reported-by: kernel test robot Signed-off-by: Kirill A. Shutemov Signed-off-by: Dave Hansen Link: https://lore.kernel.org/all/20221116004353.15052-3-kirill.shutemov%40linux.intel.com --- arch/x86/include/asm/uaccess.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 1d2c792..bd92e1e 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -43,7 +43,7 @@ DECLARE_STATIC_KEY_FALSE(tagged_addr_key); #define untagged_ptr(mm, ptr) ({ \ u64 __ptrval = (__force u64)(ptr); \ __ptrval = untagged_addr(mm, __ptrval); \ - (__force __typeof__(*(ptr)) *)__ptrval; \ + (__force __typeof__(ptr))__ptrval; \ }) #else #define untagged_addr(mm, addr) (addr) @@ -158,10 +158,8 @@ extern int __get_user_bad(void); */ #define get_user(x,ptr) \ ({ \ - __typeof__(*(ptr)) __user *__ptr_clean; \ - __ptr_clean = untagged_ptr(current->mm, ptr); \ might_fault(); \ - do_get_user_call(get_user,x,__ptr_clean); \ + do_get_user_call(get_user,x,untagged_ptr(current->mm, ptr)); \ }) /** @@ -263,10 +261,8 @@ extern void __put_user_nocheck_8(void); * Return: zero on success, or -EFAULT on error. */ #define put_user(x, ptr) ({ \ - __typeof__(*(ptr)) __user *__ptr_clean; \ - __ptr_clean = untagged_ptr(current->mm, ptr); \ might_fault(); \ - do_put_user_call(put_user,x,__ptr_clean); \ + do_put_user_call(put_user,x,untagged_ptr(current->mm, ptr)); \ }) /**