diff mbox

[3/3] ALSA: tascam: clear extra MIDI byte of asynchronous transaction

Message ID 1445162538-12293-4-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto Oct. 18, 2015, 10:02 a.m. UTC
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@sakamocchi.jp>
---
 sound/firewire/tascam/tascam-transaction.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

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;
 }