Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8d09e3a authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: opl3: Fix possible negative array index access



Spotted by coverity CID 115196.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a40a3937
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -390,6 +390,11 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
		voice = snd_opl3_oss_map[chan->number];		
	}

	if (voice < 0) {
		spin_unlock_irqrestore(&opl3->voice_lock, flags);
		return;
	}

	if (voice < MAX_OPL2_VOICES) {
		/* Left register block for voices 0 .. 8 */
		reg_side = OPL3_LEFT;