[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: Adrian Bunk <bunk@stusta.de>
This commit is contained in:
Adrian Bunk
2006-12-15 00:24:31 +01:00
parent bbd75502c5
commit 2b12669873
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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];