]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
[ALSA] sound/core/: fix 3 off-by-one errors
authorAdrian Bunk <bunk@stusta.de>
Thu, 14 Dec 2006 23:24:31 +0000 (00:24 +0100)
committerAdrian Bunk <bunk@stusta.de>
Thu, 14 Dec 2006 23:24:31 +0000 (00:24 +0100)
This patch fixes three off-by-one errors found by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
sound/core/sound.c
sound/core/sound_oss.c

index a8eda02bcf1c0fe886b922ac0b628f7152a52921..5ac097605af2a59ca636abdffd792ba62108b4e9 100644 (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) {
index d0be32b517c1567f99cdbd7e590958d1fe8c07bb..79752205c5c6b77028cce363c225ab7c3a2aea2d 100644 (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];