diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-10-29 10:07:19 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-10-29 10:07:19 -0400 |
commit | a8d09e3a6dfc44fd2246f3c57d2cd00e1a56e2bd (patch) | |
tree | 388221310817c32736967e0622027c93ebb0c7e4 /sound/drivers/opl3 | |
parent | a40a3937222c728be925f2d78650cfe9b20be3f5 (diff) |
ALSA: opl3: Fix possible negative array index access
Spotted by coverity CID 115196.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers/opl3')
-rw-r--r-- | sound/drivers/opl3/opl3_midi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 0c796bcbc0a3..6c6d09a51f42 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c | |||
@@ -390,6 +390,11 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) | |||
390 | voice = snd_opl3_oss_map[chan->number]; | 390 | voice = snd_opl3_oss_map[chan->number]; |
391 | } | 391 | } |
392 | 392 | ||
393 | if (voice < 0) { | ||
394 | spin_unlock_irqrestore(&opl3->voice_lock, flags); | ||
395 | return; | ||
396 | } | ||
397 | |||
393 | if (voice < MAX_OPL2_VOICES) { | 398 | if (voice < MAX_OPL2_VOICES) { |
394 | /* Left register block for voices 0 .. 8 */ | 399 | /* Left register block for voices 0 .. 8 */ |
395 | reg_side = OPL3_LEFT; | 400 | reg_side = OPL3_LEFT; |