Commit 02bb57aeb092cbb0dfdb50c6026dbd0c60af7644
Committed by
Takashi Iwai
1 parent
0c3c35e148
Exists in
master
and in
39 other branches
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>
Showing 2 changed files with 2 additions and 2 deletions Side-by-side Diff
sound/oss/midi_synth.c
... | ... | @@ -426,7 +426,7 @@ |
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; |
sound/oss/mpu401.c
... | ... | @@ -770,7 +770,7 @@ |
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]; |