Skip to contentSkip to conversation

ALSA: firewire-tascam: off by one in handle_midi_tx()

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 15, 2015 – Oct 17, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ALSA: firewire-tascam: off by one in handle_midi_tx()

My static checker complains because tscm->spec->midi_capture_ports is either 2 or 4 but the tscm->tx_midi_substreams[] array has 4 elements so this is possibly off by one. I have looked at the code and I think it should be >= instead of > as well.

Fixes 107cc0129a68 ('ALSA: firewire-tascam: add support for incoming MIDI messages by asynchronous transaction')
sound/firewire/tascam/tascam-transaction.c +1 -1
index 45c3ce3..d4f64ae 100644
@@ -158,7 +158,7 @@ static void handle_midi_tx(struct fw_card *card, struct fw_request *request,
 
 		port = b[0] >> 4;
 		/* TODO: support virtual MIDI ports. */
-		if (port > tscm->spec->midi_capture_ports)
+		if (port >= tscm->spec->midi_capture_ports)
 			goto end;
 
 		/* Assume the message length. */
Applied
#1 lore raw
Quoted 8 lines · Dan Carpenter

My static checker complains because tscm->spec->midi_capture_ports is either 2 or 4 but the tscm->tx_midi_substreams[] array has 4 elements so this is possibly off by one. I have looked at the code and I think it should be >= instead of > as well.

Fixes 107cc0129a68 ('ALSA: firewire-tascam: add support for incoming MIDI messages by asynchronous transaction')

Applied, thanks.

Takashi

Quoted 15 lines
sound/firewire/tascam/tascam-transaction.c +1 -1
index 45c3ce3..d4f64ae 100644
@@ -158,7 +158,7 @@ static void handle_midi_tx(struct fw_card *card, struct fw_request *request,
 
 		port = b[0] >> 4;
 		/* TODO: support virtual MIDI ports. */
-		if (port > tscm->spec->midi_capture_ports)
+		if (port >= tscm->spec->midi_capture_ports)
 			goto end;
 
 		/* Assume the message length. */