public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] ALSA: firewire-tascam: off by one in handle_midi_tx()
@ 2015-10-15 18:17 Dan Carpenter
  2015-10-17 10:12 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-15 18:17 UTC (permalink / raw)
  To: Clemens Ladisch, Takashi Sakamoto
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel-janitors

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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c
index 45c3ce3..d4f64ae 100644
--- a/sound/firewire/tascam/tascam-transaction.c
+++ b/sound/firewire/tascam/tascam-transaction.c
@@ -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. */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 2/2] ALSA: firewire-tascam: off by one in handle_midi_tx()
  2015-10-15 18:17 [patch 2/2] ALSA: firewire-tascam: off by one in handle_midi_tx() Dan Carpenter
@ 2015-10-17 10:12 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2015-10-17 10:12 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Clemens Ladisch, Takashi Sakamoto, alsa-devel, Jaroslav Kysela,
	kernel-janitors

On Thu, 15 Oct 2015 20:17:11 +0200,
Dan Carpenter wrote:
> 
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c
> index 45c3ce3..d4f64ae 100644
> --- a/sound/firewire/tascam/tascam-transaction.c
> +++ b/sound/firewire/tascam/tascam-transaction.c
> @@ -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. */
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-17 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 18:17 [patch 2/2] ALSA: firewire-tascam: off by one in handle_midi_tx() Dan Carpenter
2015-10-17 10:12 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox