Skip to content

Commit

Permalink
sound: OSS: keep index within bounds of midi_devs[]
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Takashi Iwai committed Nov 16, 2009
1 parent 0c3c35e commit 02bb57a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sound/oss/midi_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ midi_synth_open(int dev, int mode)
int err;
struct midi_input_info *inc;

if (orig_dev < 0 || orig_dev > num_midis || midi_devs[orig_dev] == NULL)
if (orig_dev < 0 || orig_dev >= num_midis || midi_devs[orig_dev] == NULL)
return -ENXIO;

midi2synth[orig_dev] = dev;
Expand Down
2 changes: 1 addition & 1 deletion sound/oss/mpu401.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ static int mpu_synth_ioctl(int dev, unsigned int cmd, void __user *arg)

midi_dev = synth_devs[dev]->midi_dev;

if (midi_dev < 0 || midi_dev > num_midis || midi_devs[midi_dev] == NULL)
if (midi_dev < 0 || midi_dev >= num_midis || midi_devs[midi_dev] == NULL)
return -ENXIO;

devc = &dev_conf[midi_dev];
Expand Down

0 comments on commit 02bb57a

Please sign in to comment.