Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sound: OSS: keep index within bounds of midi_devs[]

When the {orig,midi}_dev equals num_midis, that's one too
large already.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Roel Kluin and committed by
Takashi Iwai
02bb57ae 0c3c35e1

+2 -2
+1 -1
sound/oss/midi_synth.c
··· 426 426 int err; 427 427 struct midi_input_info *inc; 428 428 429 - if (orig_dev < 0 || orig_dev > num_midis || midi_devs[orig_dev] == NULL) 429 + if (orig_dev < 0 || orig_dev >= num_midis || midi_devs[orig_dev] == NULL) 430 430 return -ENXIO; 431 431 432 432 midi2synth[orig_dev] = dev;
+1 -1
sound/oss/mpu401.c
··· 770 770 771 771 midi_dev = synth_devs[dev]->midi_dev; 772 772 773 - if (midi_dev < 0 || midi_dev > num_midis || midi_devs[midi_dev] == NULL) 773 + if (midi_dev < 0 || midi_dev >= num_midis || midi_devs[midi_dev] == NULL) 774 774 return -ENXIO; 775 775 776 776 devc = &dev_conf[midi_dev];