Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2856841rdb; Fri, 22 Sep 2023 10:07:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHV+s1qM+9SRyXOYTbFalpvONxjYrUuzw7vwJiOrvHhauL9Gni/QGqRUw5z8D1NlvJ5v4uY X-Received: by 2002:a05:6a20:5490:b0:15a:68a4:519a with SMTP id i16-20020a056a20549000b0015a68a4519amr175510pzk.14.1695402455879; Fri, 22 Sep 2023 10:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695402455; cv=none; d=google.com; s=arc-20160816; b=M3zBleAOG49lLj32912Ei2HoV8W9KUdV1nr6I21eBSFsFXacc38fZVDMy39kTYdnLn 2q/KDKYmvaxdGDIgdvzlXRzZJsYH4oUT44QReRt9sUKRpnwM4ibKW84ZPaKuvYXsPldb JjXPyX55PbJdh5Djhz+X2yfRIEjVHINDXKE43gqqzemxw8GFWUMZxMOPKemqkAtTgIAM UUW5kRq1tz7PrwtznKKqOAFf4CFxnZgkyZpzernMMkPG26MlAi6lDOzoYqHgmvrOoCQE lhB4PqLOzSoiIdQ3QOLMqDDcTZRQucxlM8mpihH/ITfqYXymQ6hKkgCozxl0bg/Ic83K 9B2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oQ7llY41C7nXc6PO5+rWDb67yJZYIoiIAsyEYwhjg+w=; fh=yNhzPmA6q3zjPRL2qmIWzYzVdf+n3EWEJWO+Xa1c5SQ=; b=NG8bxkG6hkEFWy3rn5JfaZfaapNR6d2HRZ8Tlu6aQQHSpjBjLVL/cTCeCiIzJjrEkI m64FJ+lRpDzs9nLBOwoy6MC1fNtBIXiTHLCScs3CSJP8DbwBBW031z76SU4c0xIP3eBn nrB1zizL2Cj+3MwgVq5X5SWrIJ40KSFs2pbw5kv3aFnLBXSIpTAwdf3DkLYtGoAGyYz8 +TBbgeduPHGiCEfIigOBgUGjgiEzN8qOYHQB3F+q83ESRa4B0Mcc4lXkbRGEnKQHhrKY oui7xdraR1mXFHzZ+thSsd+0uIU8pn6AVjnABIkFW3vgjkw94tNIy4+TsyXNI6qP3BPp QPrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L+Oqe1NY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bx17-20020a056a00429100b00666c9148d03si4056939pfb.6.2023.09.22.10.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L+Oqe1NY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 81DB08325205; Fri, 22 Sep 2023 05:03:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234024AbjIVMDq (ORCPT + 99 others); Fri, 22 Sep 2023 08:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233983AbjIVMDh (ORCPT ); Fri, 22 Sep 2023 08:03:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E06122 for ; Fri, 22 Sep 2023 05:02:44 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 22 Sep 2023 05:03:53 -0700 (PDT) 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); }