From patchwork Sat Sep 2 06:10:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13373032 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 3562CCA0FFC for ; Sat, 2 Sep 2023 06:12:37 +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 C85693E8; Sat, 2 Sep 2023 08:11:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C85693E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693635155; bh=Q+h8IrjcBiP0V8a2rLvYQrFoUABVRhYY4wbXJP6aZ6s=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=NuL3EvcaLhnuaX6wgC021AVuQos8/8swhvMTrDsQc6lkustA7nrBpi2AUv0LTIbfS uZfoCBNO7B06B4IYGjroaqxkmbEtszlsFs0aHY4RNB1w0gZ3I+jxXkUhn8IMnnDyDX KtMbir4TnXq/bBezH2p4w09QT/R1jQDbwzvLCBrU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 65979F80549; Sat, 2 Sep 2023 08:11:26 +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 979B8F8032D; Sat, 2 Sep 2023 08:11:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5AC97F804DA; Sat, 2 Sep 2023 08:11:22 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 74F17F800F5 for ; Sat, 2 Sep 2023 08:11:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 74F17F800F5 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=ar221e/w; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=uUvxiMMK 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-out2.suse.de (Postfix) with ESMTPS id DC38B1F45F; Sat, 2 Sep 2023 06:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693635078; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=uJN5skSgqO36GV5GT+zFtouE3vjHITi6azy/wCQ7+UU=; b=ar221e/wn9iQdWW6YBo3db8ajXaPMcZfqT+eFXKK6J0MwhUQlsGyUQ4KG3KsHVauTmiTwt t1yYvpLAwGXFHMvz1vS4E2OcjW+ouiK9dGHWkBUxhD6lPzTMB+CmIx6zRPdhvfVvDgH6gr 9fj2PdFVpQrhVehooBUGVtHk5DhMjrs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693635078; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=uJN5skSgqO36GV5GT+zFtouE3vjHITi6azy/wCQ7+UU=; b=uUvxiMMKWDXaqUmggL0MVt7TV8vC2KKzaD2e4XlAc9K/5jEV1bvSOg9hR+YdY3dv6ojv85 C7cpQ2Nhqm28mUAA== 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 BC88413440; Sat, 2 Sep 2023 06:11:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id abzeLAbS8mTGUgAAMHmgww (envelope-from ); Sat, 02 Sep 2023 06:11:18 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Al Viro Subject: [PATCH 1/2] ALSA: pcm: Fix error checks of default read/write copy ops Date: Sat, 2 Sep 2023 08:10:43 +0200 Message-Id: <20230902061044.19366-1-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Message-ID-Hash: SFUEXIP642SG265CGHK2SWNPT4MANR43 X-Message-ID-Hash: SFUEXIP642SG265CGHK2SWNPT4MANR43 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: copy_from/to_iter() returns the actually copied bytes, and the more correct check should be to compare with the given bytes, instead of zero-check. Fixes: cf393babb37a ("ALSA: pcm: Add copy ops with iov_iter") Reported-by: Al Viro Closes: https://lore.kernel.org/r/20230902053044.GJ3390869@ZenIV Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 4859fb1caec9..a11cd7d6295f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1992,8 +1992,8 @@ static int default_write_copy(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, struct iov_iter *iter, unsigned long bytes) { - if (!copy_from_iter(get_dma_ptr(substream->runtime, channel, hwoff), - bytes, iter)) + if (copy_from_iter(get_dma_ptr(substream->runtime, channel, hwoff), + bytes, iter) != bytes) return -EFAULT; return 0; } @@ -2025,8 +2025,8 @@ static int default_read_copy(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, struct iov_iter *iter, unsigned long bytes) { - if (!copy_to_iter(get_dma_ptr(substream->runtime, channel, hwoff), - bytes, iter)) + if (copy_to_iter(get_dma_ptr(substream->runtime, channel, hwoff), + bytes, iter) != bytes) return -EFAULT; return 0; } From patchwork Sat Sep 2 06:10:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13373033 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 529E5CA0FF8 for ; Sat, 2 Sep 2023 06:13:09 +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 7EE6384B; Sat, 2 Sep 2023 08:12:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7EE6384B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693635187; bh=7Ht7VNQ4Keq7ZFCScRxdxr+G46e3KdEGzQF+1u5D2Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=slDLT0QEmk8fJBfvRKEtv8iTb4JZ3sBxE96lItn+Y0+vnQhVdyDPotb8Rd1mjxo5J NX2ys0TAHuiLp3aVQD1qzK6H2JtziR7ZPmABsP6Sxm9WL/+hmDlUN6U+qd1AnjEplp FoSQxGEUEbD0lFXiKrb31VZwwQ32cb2F+KnqrCHE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9013EF8055B; Sat, 2 Sep 2023 08:11:28 +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 27C80F8055A; Sat, 2 Sep 2023 08:11:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CA00AF8032D; Sat, 2 Sep 2023 08:11:23 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 2417CF80074 for ; Sat, 2 Sep 2023 08:11:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2417CF80074 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=iVjx8aRl; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=poMtVKZN 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-out2.suse.de (Postfix) with ESMTPS id 191DC1F74B; Sat, 2 Sep 2023 06:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693635079; h=from:from:reply-to: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=HOFMR9IUsvsie+hyKY3JUIxrb5u8+664pYqo6FEGNkQ=; b=iVjx8aRlAE2Pv8+08kn/ZngiP8kMfKlW4h/2J0IetE8KnoFBDNK1X7UkCZ2RikwPUbQViy e5bLo5/dywaXOsXei0LSAkR9GFAWUAkMXG5H+DHfwKGxOKrEZXbr+3jmjps8SgHcjB28w7 PNypmh4RYRmksOh28d3p76E24pED3ps= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693635079; h=from:from:reply-to: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=HOFMR9IUsvsie+hyKY3JUIxrb5u8+664pYqo6FEGNkQ=; b=poMtVKZNMLUpC+Nolrq9VOdp8geoGVCylnXaV1YDz6IoB9S2atRQ+ST0h06HIVZX8w1C6o oxqXqWutxxy95UAw== 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 DF7AB13A18; Sat, 2 Sep 2023 06:11:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4Aq8NQbS8mTGUgAAMHmgww (envelope-from ); Sat, 02 Sep 2023 06:11:18 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Al Viro Subject: [PATCH 2/2] ALSA: sb: Fix wrong argument in commented code Date: Sat, 2 Sep 2023 08:10:44 +0200 Message-Id: <20230902061044.19366-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230902061044.19366-1-tiwai@suse.de> References: <20230902061044.19366-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: H53YX56UFCZQIIW6N6WP3OG7OK2QY2AK X-Message-ID-Hash: H53YX56UFCZQIIW6N6WP3OG7OK2QY2AK 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: While rewriting the code from sockptr_t to iov_iter during the development, I forgot to replace one place in emu8000-pcm code. As it's in the disabled area (with ifdef), it's never built and overlooked. Replace with the proper argument NULL. Fixes: 9d0fdc602de9 ("ALSA: emu8000: Convert to generic PCM copy ops") Reported-by: Al Viro Closes: https://lore.kernel.org/r/20230902053646.GK3390869@ZenIV Signed-off-by: Takashi Iwai --- sound/isa/sb/emu8000_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index c05935c2edc4..9234d4fe8ada 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c @@ -456,7 +456,7 @@ static int emu8k_pcm_silence(struct snd_pcm_substream *subs, /* convert to word unit */ pos = (pos << 1) + rec->loop_start[voice]; count <<= 1; - LOOP_WRITE(rec, pos, USER_SOCKPTR(NULL), count); + LOOP_WRITE(rec, pos, NULL, count); return 0; }