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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47BC2C001B0 for ; Tue, 15 Aug 2023 13:55:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3B63A832; Tue, 15 Aug 2023 15:54:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3B63A832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692107743; bh=gKkrmPTEpn+BPnntj8i23b1j8vNCDlCueJZPnwhDYjI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gUf2gLumscn7Qjnss/pfeS9Jb9Yo1HjjeitTRnOwBcoofsNP5d+dmF1OZRhLNkY4O vnELXKMRKVPWFjncjxJ+iFhpPwtDfeuTqO/r9bA0dzBUSHOyKiGRaBZw59RTQDwQJc PO/8+GeWhDwmOmaldIptvvrobTjQFL2zwxLizACI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 45A11F80510; Tue, 15 Aug 2023 15:54:24 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D9A18F8016D; Tue, 15 Aug 2023 15:54:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B603EF8016D; Tue, 15 Aug 2023 15:54:20 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9EBEAF80027 for ; Tue, 15 Aug 2023 15:54:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9EBEAF80027 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=rfem9i8l; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=wMl8sKEa 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 Message-ID-Hash: 5YM663Q62DWL4I4KGJNQ2A3GBDFXWNZH X-Message-ID-Hash: 5YM663Q62DWL4I4KGJNQ2A3GBDFXWNZH X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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