[PATCH 5.15 009/207] ALSA: usb-audio: Fix packet size calculation regression

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2021-12-06 15:36:26
Also in
lkml
Reply to
Greg Kroah-Hartman, 2021-12-06
From: Takashi Iwai <redacted>

commit 23939115be181bc5dbc33aa8471adcdbffa28910 upstream.

The commit d215f63d49da ("ALSA: usb-audio: Check available frames for
the next packet size") introduced the available frame size check, but
the conversion forgot to initialize the temporary variable properly,
and it resulted in a bogus calculation.  This patch fixes it.

Fixes: d215f63d49da ("ALSA: usb-audio: Check available frames for the next packet size")
Reported-by: Colin Ian King <redacted>
Link: https://lore.kernel.org/r/20211001104417.14291-1-colin.king@canonical.com (local)
Link: https://lore.kernel.org/r/20211001105425.16191-1-tiwai@suse.de (local)
Signed-off-by: Takashi Iwai <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/endpoint.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -182,7 +182,7 @@ static int next_packet_size(struct snd_u
 	if (ep->fill_max)
 		return ep->maxframesize;
 
-	sample_accum += ep->sample_rem;
+	sample_accum = ep->sample_accum + ep->sample_rem;
 	if (sample_accum >= ep->pps) {
 		sample_accum -= ep->pps;
 		ret = ep->packsize[1];

Thread (215 messages) 215 messages, 8 authors, last reply 2021-12-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help