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 9863EC04A6A for ; Tue, 15 Aug 2023 13:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237449AbjHONyi (ORCPT ); Tue, 15 Aug 2023 09:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237495AbjHONyV (ORCPT ); Tue, 15 Aug 2023 09:54:21 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 713D0199F for ; Tue, 15 Aug 2023 06:54:18 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2A6742186F; Tue, 15 Aug 2023 13:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692107657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qlu9hn+bvH89g0o8QY1YoKNm1RBkRpBhGERxF0lUqKo=; b=rfem9i8l+lr5wJV1iAYuOB62wQT6CkXsY9ONOFLDZUP8ATjxKAIwYqI/dYZQaaniJfWMXH iIDQ6ZTD7mJ8FPQA6Pa6ZOf1AC9CNr6BQP1h69PeJoAwBDCFHubNbvNdf3z24GsM6qabnX e+dDdU89dmVipUxhTrnJV/Lfk1vpWys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692107657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qlu9hn+bvH89g0o8QY1YoKNm1RBkRpBhGERxF0lUqKo=; b=wMl8sKEaSb9QoQg/JXMSYcXuzvXKBia4hRUycSCw4YE/qlh7xTbkgdC9sQrJ+uknoA/gzi YCi3lXHe8SwG5MAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 090941353E; Tue, 15 Aug 2023 13:54:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hxDZAImD22S9QwAAMHmgww (envelope-from ); Tue, 15 Aug 2023 13:54:17 +0000 Date: Tue, 15 Aug 2023 15:54:16 +0200 Message-ID: <871qg4za0n.wl-tiwai@suse.de> From: Takashi Iwai To: Andy Shevchenko Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/25] ALSA: core: Add memory copy helpers between iov_iter and iomem In-Reply-To: References: <20230814115523.15279-1-tiwai@suse.de> <20230814115523.15279-4-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Aug 2023 15:51:30 +0200, Andy Shevchenko wrote: > > On Mon, Aug 14, 2023 at 01:55:01PM +0200, Takashi Iwai wrote: > > Add two more helpers for copying memory between iov_iter and iomem, > > which will be used by the new PCM copy ops in a few drivers. > > The existing helpers became wrappers of those now. > > > > Note that copy_from/to_iter() returns the copied bytes, hence the > > error condition is inverted from copy_from/to_user(). > > ... > > > - return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0; > > + return !copy_to_iter((const void __force *)src, count, dst) ? -EFAULT : 0; > > Inverted means, I believe, this > > return copy_to_iter((const void __force *)src, count, dst) == count ? 0 : -EFAULT; > > as far as I understand the idea behind the copy_to_user() return value. > > Ditto for other cases. OK, this looks more correct. I'll fix in v2. thanks, Takashi