summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2006-12-15 00:24:31 +0100
committerAdrian Bunk <bunk@stusta.de>2006-12-15 00:24:31 +0100
commit2b12669873c4e2a5b2f9d4ccc84653832b06c2ff (patch)
tree305862ece6a74e2b8b00c9b9a331ac59f7df361f /sound
parentbbd75502c59f723ef672861339aa80a1b5cdb658 (diff)
[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>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/sound_oss.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c
index a8eda02bcf1c..5ac097605af2 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -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) {
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index d0be32b517c1..79752205c5c6 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -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];