From mboxrd@z Thu Jan 1 00:00:00 1970 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 4A5A1C43334 for ; Thu, 7 Jul 2022 19:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235978AbiGGTGb (ORCPT ); Thu, 7 Jul 2022 15:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233757AbiGGTGa (ORCPT ); Thu, 7 Jul 2022 15:06:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2198157230; Thu, 7 Jul 2022 12:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=05SlPgOjw8Ge7G3S7ysnQzpGsSQeCNpy+r8rpobhENo=; b=Vbk/7NvhWFnJ0xBPYy409PU2F8 kH3S9RPlLO4ChI+L3vk7Awx/gNAS8+F2row0fMBq+SKGAuDiu2wy62hQlZWqyNgGPUW+72uzuFdPU GXlGo2d+FU8Ot9NIKmZLzmW6vc3MpiNUYehYjIzf0mkLtJoxyjcLI+Roj6gzQrQP71ELtAJpa7DJG j6VOZpP+WyZxGY403J/cpIJ0nCXlcYxJJXqgp4RqxM0oBBl/mMJR3Walhj34C1/qOyxtoZQ2CVctp 5xgRVQmJiNiFCjEBn0kP/OUKZIYlNJIf+EXxWjYqpubrKnKAcqykBp9oF4TJbgJN+XQzlkVz5fUK9 X+nOKZLQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o9WpQ-002qNW-3O; Thu, 07 Jul 2022 19:06:20 +0000 Date: Thu, 7 Jul 2022 20:06:20 +0100 From: Matthew Wilcox To: Al Viro Cc: Alexander Gordeev , Alexander Egorenkov , Heiko Carstens , Vasily Gorbik , Baoquan He , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH v2 1/1] s390/crash: allow multi-segment iterators Message-ID: References: <613f63d652bb4fa6fb3d2bb38762de6bb066b35a.1657172539.git.agordeev@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On Thu, Jul 07, 2022 at 02:31:44PM +0100, Al Viro wrote: > > @@ -73,10 +73,9 @@ int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count) > > } > > offset = src % PAGE_SIZE; > > bytes = min(PAGE_SIZE - offset, count); > > - if (copy_to_user(dest, hsa_buf + offset, bytes)) > > + if (copy_to_iter(hsa_buf + offset, bytes, iter) != bytes) > > return -EFAULT; > > Umm... Then you want iov_iter_revert() on short copy... ... maybe better to change the calling convention to return the short write and have the caller do it if they care?