[2.6 patch] sound/core/: fix 3 off-by-one errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes three off-by-one errors found by the Coverity checker.


Signed-off-by: Adrian Bunk <[email protected]>

---

 sound/core/sound.c     |    4 ++--
 sound/core/sound_oss.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- linux-2.6.16-rc5-mm3-full/sound/core/sound.c.old	2006-03-11 03:03:04.000000000 +0100
+++ linux-2.6.16-rc5-mm3-full/sound/core/sound.c	2006-03-11 03:04:59.000000000 +0100
@@ -121,7 +121,7 @@ void *snd_lookup_minor_data(unsigned int
 	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,
 	const 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) {
--- linux-2.6.16-rc5-mm3-full/sound/core/sound_oss.c.old	2006-03-11 03:05:48.000000000 +0100
+++ linux-2.6.16-rc5-mm3-full/sound/core/sound_oss.c	2006-03-11 03:06:01.000000000 +0100
@@ -46,7 +46,7 @@ void *snd_lookup_oss_minor_data(unsigned
 	struct snd_minor *mreg;
 	void *private_data;
 
-	if (minor > ARRAY_SIZE(snd_oss_minors))
+	if (minor >= ARRAY_SIZE(snd_oss_minors))
 		return NULL;
 	mutex_lock(&sound_oss_mutex);
 	mreg = snd_oss_minors[minor];

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux