From 3a63e44420932852efd6a7d6d46cdad4d427f880 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 13 Mar 2006 14:14:10 +0100 Subject: [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 Signed-off-by: Takashi Iwai --- sound/core/sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/core/sound.c') diff --git a/sound/core/sound.c b/sound/core/sound.c index df4ab94d006..4d28e521261 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) struct snd_minor *mreg; void *private_data; - if (minor > ARRAY_SIZE(snd_minors)) + if (minor >= ARRAY_SIZE(snd_minors)) return NULL; mutex_lock(&sound_mutex); mreg = snd_minors[minor]; @@ -140,7 +140,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) { -- cgit v1.2.3