From patchwork Thu May 25 08:31:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 686433 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 DB064C77B7A for ; Thu, 25 May 2023 08:32:31 +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 59BD974C; Thu, 25 May 2023 10:31:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 59BD974C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685003549; bh=gLE6atwbXfyB8LdhVJxtYTlBdpJcgv/0I1RpzdTtOqY=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=FSEdffdw3WO5WUk7JvT+m+I+DHnrwn//MFd24Go6XxeLlEIN7KkSNnAy7wqBzNSJf /BC5YAQ7q3TA0msnGZK+4T7/PfV5Y9gELJcFc0/2IVOvsI7RB+0Qg9jXn3TzDBOAst cjCZqejk5GpVGAWsxi89IWHlHZq1XWwniTsg3+kE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C905BF80548; Thu, 25 May 2023 10:31:38 +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 56C52F8053D; Thu, 25 May 2023 10:31:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 103CCF8024E; Thu, 25 May 2023 10:31:35 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 0AF44F80249 for ; Thu, 25 May 2023 10:31:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0AF44F80249 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=oLDBbTg5; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=O7RzbkAL 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 7AB5F21D1F; Thu, 25 May 2023 08:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1685003488; 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=1vfaA4+pkWAA6TMGbFG3XewEliaJ+L4s9UyhIfpw/fE=; b=oLDBbTg5inpWZ7N947AETIwVwA+tx0FXND/RQl78IhtDz31HHDJFLKVZSj7jTfyIVeGVMu 6IJRX4/ug4Y+D3kaYcUB1aO5+ycmIhgg+Bs1x8gTz9pCwoZgibLSnXwc7vuGUv+LN5wnym /+/6WS0NlXgCnNTW7r6pwrpGBygoUzo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1685003488; 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=1vfaA4+pkWAA6TMGbFG3XewEliaJ+L4s9UyhIfpw/fE=; b=O7RzbkALm3BAg6pcFXOLReNtTkHw/bA6nufogeya4NcieCtr2p0ZhYeDT8vHhNWA9ZPGnm XCLID4LB8IjBtrDw== 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 5114E13356; Thu, 25 May 2023 08:31:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2XT1EuAcb2S8OwAAMHmgww (envelope-from ); Thu, 25 May 2023 08:31:28 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Dan Carpenter Subject: [PATCH 1/2] ALSA: ump: Drop redundant check of note-on with zero velocity Date: Thu, 25 May 2023 10:31:23 +0200 Message-Id: <20230525083124.15277-1-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Message-ID-Hash: PRCU7WCAZW5PK4P3IESKA62WTHI5Z7ZV X-Message-ID-Hash: PRCU7WCAZW5PK4P3IESKA62WTHI5Z7ZV 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: The check of a note-on event with zero velocity is done twice, and the latter one is superfluous. Let's drop it. Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support") Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/4683198a-84f6-4238-9e87-c70667d84523@kili.mountain Suggested-by: Dan Carpenter Signed-off-by: Takashi Iwai --- sound/core/ump_convert.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c index cb7c2f959a27..164829d3e305 100644 --- a/sound/core/ump_convert.c +++ b/sound/core/ump_convert.c @@ -340,9 +340,6 @@ static int cvt_legacy_cmd_to_ump(struct snd_ump_endpoint *ump, switch (status) { case UMP_MSG_STATUS_NOTE_ON: - if (!buf[2]) - status = UMP_MSG_STATUS_NOTE_OFF; - fallthrough; case UMP_MSG_STATUS_NOTE_OFF: midi2->note.note = buf[1]; midi2->note.velocity = upscale_7_to_16bit(buf[2]); From patchwork Thu May 25 08:31:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 685667 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 5D03CC7EE2E for ; Thu, 25 May 2023 08:32:39 +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 36521828; Thu, 25 May 2023 10:31:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 36521828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685003557; bh=dQyTiDmLPKQ7vE8kQ7+rUL1E+RkgY/M6fZ74/9vXoms=; 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=CQ5MPaTo2s7zDjhuswDvEzdUaUz39sPgKWcQkticTZA4kItTsFR5y6HXJZm/GkUXa vslYQKY9fD73yWJnpC3X0HEHMoNS9y0LtqTV87+F7nh7G9FfmC7ea/IBTZwg7JVEhT davHxg0CSjVk5inMlWtZtQNg/Cj6fkttmORIQSOo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BDB5FF80570; Thu, 25 May 2023 10:31:41 +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 0D80CF80564; Thu, 25 May 2023 10:31:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A715EF80249; Thu, 25 May 2023 10:31:36 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 6C5CAF800DF for ; Thu, 25 May 2023 10:31:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6C5CAF800DF 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=E7ClCj8Y; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=npi77G6B 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 9920821D22; Thu, 25 May 2023 08:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1685003488; 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=8fYnx6lVpoaihh5ZwZObd16wZDSmGU5kcbqQVO+9MiU=; b=E7ClCj8Y8oQpBQpnlSrS7H/hHYaK+ZOBn6pLu39gTxjvTsUFfoB4BK3nuRvbomgEPhWG8m mkE+CCSlquzn5/J59M4VMVNbgbA1gls/9DBr3+ATJdsOjonxRKJMS6LvZYFvMkFRkRX14M U8423Ufa24kQEQpxkVzDOUp61PTeyIw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1685003488; 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=8fYnx6lVpoaihh5ZwZObd16wZDSmGU5kcbqQVO+9MiU=; b=npi77G6BXnAVCj/bxsz2iM0jQloaMXtQ40r/1Sp0x0Mv+CQraTkfWwnWz5ARGcPTGiyuzU iJiq9wym2PhhkMBg== 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 7CCBE13A2C; Thu, 25 May 2023 08:31:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KNerHeAcb2S8OwAAMHmgww (envelope-from ); Thu, 25 May 2023 08:31:28 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Dan Carpenter Subject: [PATCH 2/2] ALSA: ump: Fix parsing of 0xFx command Date: Thu, 25 May 2023 10:31:24 +0200 Message-Id: <20230525083124.15277-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230525083124.15277-1-tiwai@suse.de> References: <20230525083124.15277-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: T5NGU6LPKYECVOSGEJZ23LZ5GX3VEBUN X-Message-ID-Hash: T5NGU6LPKYECVOSGEJZ23LZ5GX3VEBUN 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: The MIDI 1.0 parser retrieved the 0xFx command with a wrong bit shift, resulting in the bogus type. Fix the bit shift size. Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support") Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/0fbc0b27-54b8-4cda-800e-37e7a03fed39@kili.mountain Suggested-by: Dan Carpenter Signed-off-by: Takashi Iwai --- sound/core/ump_convert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c index 164829d3e305..48ab3e1bd62e 100644 --- a/sound/core/ump_convert.c +++ b/sound/core/ump_convert.c @@ -454,7 +454,7 @@ static int do_convert_to_ump(struct snd_ump_endpoint *ump, } if (c & 0x80) { - bytes = cmd_bytes[(c >> 8) & 7]; + bytes = cmd_bytes[(c >> 4) & 7]; cvt->buf[0] = c; cvt->len = 1; cvt->cmd_bytes = bytes;