Skip to contentSkip to conversation

staging: bcm2835-audio: off by one in snd_bcm2835_playback_open_generic()

PATCH New Dan Carpenter 1 participant 1 message Feb 7, 2017

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

PATCH 1/1 staging: bcm2835-audio: off by one in snd_bcm2835_playback_open_generic()

The > should be >= otherwise we write beyond the end of the array when we do:

	chip->alsa_stream[idx] = alsa_stream;
Fixes 23b028c871e1 ("staging: bcm2835-audio: initial staging submission")
drivers/staging/bcm2835-audio/bcm2835-pcm.c +1 -1
index d2d9f9b6a09b..014bf7ab69f4 100644
@@ -130,7 +130,7 @@ static int snd_bcm2835_playback_open_generic(
 		err = -EBUSY;
 		goto out;
 	}
-	if (idx > MAX_SUBSTREAMS) {
+	if (idx >= MAX_SUBSTREAMS) {
 		audio_error
 			("substream(%d) device doesn't exist max(%d) substreams allowed\n",
 			idx, MAX_SUBSTREAMS);