From patchwork Fri Sep 22 12:02:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13395700 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A5B4CD4F5B for ; Fri, 22 Sep 2023 12:02:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B025F6B02C4; Fri, 22 Sep 2023 08:02:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8AAC6B02C5; Fri, 22 Sep 2023 08:02:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92C3F6B02C6; Fri, 22 Sep 2023 08:02:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7CA316B02C4 for ; Fri, 22 Sep 2023 08:02:46 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 505141CAE87 for ; Fri, 22 Sep 2023 12:02:46 +0000 (UTC) X-FDA: 81264096732.02.488B480 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 735E314002E for ; Fri, 22 Sep 2023 12:02:44 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=L+Oqe1NY; spf=pass (imf09.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695384164; a=rsa-sha256; cv=none; b=op60KoXWqx/ndOdbr2IYZQ4BgkIAzgwL/OUgat2zSZcPmPuX8a8WWu8JC5NvZwwVbKtDjN 7lgJ1iDYF9e3cBo8tQGSQ0fOCY+jNhTkA4iVVDJV4+KywVh63Hl4PJ59o/v1JSA7KUzhEJ ysP0ODK3r49nW3Trgh0aBCUou7pW3ro= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=L+Oqe1NY; spf=pass (imf09.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695384164; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oQ7llY41C7nXc6PO5+rWDb67yJZYIoiIAsyEYwhjg+w=; b=g6uHxxwFLY6AGliTDudpLC8jHyjDNxHrnleQDBeGq6N19C7b2JdoFz43pREnrko+w69fO5 6758rxZrkPHg2MhcL7s6jMvdRhCQU6en1/KOulmxRdAhaL19i53ze5R70OyXnrvXYH1Aql CFZF+Cn+7GzrlxueOxj1BI979A912Lk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695384163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oQ7llY41C7nXc6PO5+rWDb67yJZYIoiIAsyEYwhjg+w=; b=L+Oqe1NYFS80I82W4WiOnmGWxqLWO028hlNp9dztI09N2+LNZBijCv97QzHaCpFVENWyVL loZWLlJzPHMUcA7PSzFLlqDR1ViBUYHkSgG3GoQAhK9OWX5U8r3qVuy5AJGY0W3mDnnWr9 6uAWQ6L9+Sn3oQFxhafURjj1JzfiqCc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-295-8-QZXS7iNU2GtXgc29v2FQ-1; Fri, 22 Sep 2023 08:02:37 -0400 X-MC-Unique: 8-QZXS7iNU2GtXgc29v2FQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E637185A78E; Fri, 22 Sep 2023 12:02:36 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF47A40C6EBF; Fri, 22 Sep 2023 12:02:34 +0000 (UTC) From: David Howells To: Jens Axboe Cc: David Howells , Al Viro , Linus Torvalds , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Williams Subject: [PATCH v6 02/13] iov_iter: Be consistent about the __user tag on copy_mc_to_user() Date: Fri, 22 Sep 2023 13:02:16 +0100 Message-ID: <20230922120227.1173720-3-dhowells@redhat.com> In-Reply-To: <20230922120227.1173720-1-dhowells@redhat.com> References: <20230922120227.1173720-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 735E314002E X-Stat-Signature: 9uycj678d3tzmtk7osezdppn73o3s77i X-Rspam-User: X-HE-Tag: 1695384164-238031 X-HE-Meta: U2FsdGVkX1/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124U5eZTlOZFJ6vjtbzxwYt0HNlCZY44RuvGAn09wCGmp51C12RTF9YdojPWzdkiXEuN+b1DHTiL4hBYosKaXXl2w6NzcuXB2J54u1TXk20qcwbxrLiX1uqS0fYTwGutcrlKBBr/rEsQ2UHj5du4/I6UIipJzHiMuebwqKxWQTAUVEjKv5euaD7Tf26oZiBKXdeArhL2edWuzJ510XH6woV4piL0lZnjgGPJWQF3VyDq+sQn3DUSvXCD+NjwNlRrkJdwcw+tc6sMI1BA7buNj02QRkUEuLEQw/ZZ/f2Q7B/PGqpNRjzM12aG2d0Om9gp7DbOtmLFGqVZRa4duiDiIg7lfjSndZZkkIqKfExAycWMnWPhP7ltIWY2Np8nLGbj6LqyaK+zg+kUOftNA3A9oncGV+P1DEqhtYX6g1gpBr7pfxjaEmLtaINsIsMYmIc14r6DCT3dk3AH4TjazH4+MlztnpM7UwX69cJjJglxXyK/MgEIA X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: copy_mc_to_user() has the destination marked __user on powerpc, but not on x86; the latter results in a sparse warning in lib/iov_iter.c. Fix this by applying the tag on x86 too. Fixes: ec6347bb4339 ("x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}()") Signed-off-by: David Howells cc: Dan Williams cc: Alexander Viro cc: Jens Axboe cc: Christoph Hellwig cc: Christian Brauner cc: Matthew Wilcox cc: Linus Torvalds cc: David Laight cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- arch/x86/include/asm/uaccess.h | 2 +- arch/x86/lib/copy_mc.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 8bae40a66282..5c367c1290c3 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -496,7 +496,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len); #define copy_mc_to_kernel copy_mc_to_kernel unsigned long __must_check -copy_mc_to_user(void *to, const void *from, unsigned len); +copy_mc_to_user(void __user *to, const void *from, unsigned len); #endif /* diff --git a/arch/x86/lib/copy_mc.c b/arch/x86/lib/copy_mc.c index 80efd45a7761..6e8b7e600def 100644 --- a/arch/x86/lib/copy_mc.c +++ b/arch/x86/lib/copy_mc.c @@ -70,23 +70,23 @@ unsigned long __must_check copy_mc_to_kernel(void *dst, const void *src, unsigne } EXPORT_SYMBOL_GPL(copy_mc_to_kernel); -unsigned long __must_check copy_mc_to_user(void *dst, const void *src, unsigned len) +unsigned long __must_check copy_mc_to_user(void __user *dst, const void *src, unsigned len) { unsigned long ret; if (copy_mc_fragile_enabled) { __uaccess_begin(); - ret = copy_mc_fragile(dst, src, len); + ret = copy_mc_fragile((__force void *)dst, src, len); __uaccess_end(); return ret; } if (static_cpu_has(X86_FEATURE_ERMS)) { __uaccess_begin(); - ret = copy_mc_enhanced_fast_string(dst, src, len); + ret = copy_mc_enhanced_fast_string((__force void *)dst, src, len); __uaccess_end(); return ret; } - return copy_user_generic(dst, src, len); + return copy_user_generic((__force void *)dst, src, len); }