Commit 2b126698 authored by Adrian Bunk's avatar Adrian Bunk

[ALSA] sound/core/: fix 3 off-by-one errors

This patch fixes three off-by-one errors found by the Coverity checker.
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent bbd75502
......@@ -120,7 +120,7 @@ void *snd_lookup_minor_data(unsigned int minor, int type)
struct snd_minor *mreg;
void *private_data;
if (minor > ARRAY_SIZE(snd_minors))
if (minor >= ARRAY_SIZE(snd_minors))
return NULL;
down(&sound_mutex);
mreg = snd_minors[minor];
......@@ -139,7 +139,7 @@ static int snd_open(struct inode *inode, struct file *file)
struct file_operations *old_fops;
int err = 0;
if (minor > ARRAY_SIZE(snd_minors))
if (minor >= ARRAY_SIZE(snd_minors))
return -ENODEV;
mptr = snd_minors[minor];
if (mptr == NULL) {
......
......@@ -45,7 +45,7 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type)
struct snd_minor *mreg;
void *private_data;
if (minor > ARRAY_SIZE(snd_oss_minors))
if (minor >= ARRAY_SIZE(snd_oss_minors))
return NULL;
down(&sound_oss_mutex);
mreg = snd_oss_minors[minor];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment