[alsa-devel] [PATCH 3/3] ALSA: tascam: clear extra MIDI byte of asynchronous transaction

Takashi Sakamoto o-takashi at sakamocchi.jp
Sun Oct 18 12:02:18 CEST 2015


When MIDI buffer stores two or more MIDI messages, TASCAM driver
transfers asynchronous transactions including one MIDI message and
extra bytes in second MIDI message.

This commit fixes this bug by clear needless bytes in the buffer.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 sound/firewire/tascam/tascam-transaction.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c
index 4ffaa8a..4bedfe4 100644
--- a/sound/firewire/tascam/tascam-transaction.c
+++ b/sound/firewire/tascam/tascam-transaction.c
@@ -130,6 +130,9 @@ static int fill_message(struct snd_rawmidi_substream *substream, u8 *buf)
 		buf[0] = (port << 4) | (buf[1] >> 4);
 	}
 
+	if (len < 3)
+		memset(buf + 1, 0, 3 - len);
+
 	return len;
 }
 
-- 
2.1.4



More information about the Alsa-devel mailing list