diff options
author | Adrian Bunk <bunk@stusta.de> | 2006-03-13 08:14:10 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:37:31 -0500 |
commit | 3a63e44420932852efd6a7d6d46cdad4d427f880 (patch) | |
tree | ccabe72933a23a2d8553d399128d7a35d4a21570 /sound | |
parent | 646494007b48e8897888cd407c2b7d1d69cb2e58 (diff) |
[ALSA] sound/core/: fix 3 off-by-one errors
Modules: ALSA Core
This patch fixes three off-by-one errors found by the Coverity checker.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/sound.c | 4 | ||||
-rw-r--r-- | sound/core/sound_oss.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index df4ab94d006e..4d28e5212611 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -121,7 +121,7 @@ void *snd_lookup_minor_data(unsigned int minor, int type) | |||
121 | struct snd_minor *mreg; | 121 | struct snd_minor *mreg; |
122 | void *private_data; | 122 | void *private_data; |
123 | 123 | ||
124 | if (minor > ARRAY_SIZE(snd_minors)) | 124 | if (minor >= ARRAY_SIZE(snd_minors)) |
125 | return NULL; | 125 | return NULL; |
126 | mutex_lock(&sound_mutex); | 126 | mutex_lock(&sound_mutex); |
127 | mreg = snd_minors[minor]; | 127 | mreg = snd_minors[minor]; |
@@ -140,7 +140,7 @@ static int snd_open(struct inode *inode, struct file *file) | |||
140 | struct file_operations *old_fops; | 140 | struct file_operations *old_fops; |
141 | int err = 0; | 141 | int err = 0; |
142 | 142 | ||
143 | if (minor > ARRAY_SIZE(snd_minors)) | 143 | if (minor >= ARRAY_SIZE(snd_minors)) |
144 | return -ENODEV; | 144 | return -ENODEV; |
145 | mptr = snd_minors[minor]; | 145 | mptr = snd_minors[minor]; |
146 | if (mptr == NULL) { | 146 | if (mptr == NULL) { |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index 6b4a4bccd8fe..4023d3b406de 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -46,7 +46,7 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) | |||
46 | struct snd_minor *mreg; | 46 | struct snd_minor *mreg; |
47 | void *private_data; | 47 | void *private_data; |
48 | 48 | ||
49 | if (minor > ARRAY_SIZE(snd_oss_minors)) | 49 | if (minor >= ARRAY_SIZE(snd_oss_minors)) |
50 | return NULL; | 50 | return NULL; |
51 | mutex_lock(&sound_oss_mutex); | 51 | mutex_lock(&sound_oss_mutex); |
52 | mreg = snd_oss_minors[minor]; | 52 | mreg = snd_oss_minors[minor]; |