mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rio: fix array checking
@ 2006-10-16 15:28 Alan Cox
  0 siblings, 0 replies; only message in thread
From: Alan Cox @ 2006-10-16 15:28 UTC (permalink / raw)
  To: torvalds, akpm, linux-kernel

Found by an analysis tool and reported to the list. Fix is simple enough

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc1-mm1/drivers/char/rio/rioctrl.c linux-2.6.19-rc1-mm1/drivers/char/rio/rioctrl.c
--- linux.vanilla-2.6.19-rc1-mm1/drivers/char/rio/rioctrl.c	2006-10-13 15:06:33.000000000 +0100
+++ linux-2.6.19-rc1-mm1/drivers/char/rio/rioctrl.c	2006-10-14 18:55:37.000000000 +0100
@@ -662,7 +662,7 @@
 			p->RIOError.Error = COPYIN_FAILED;
 			return -EFAULT;
 		}
-		if (portStats.port >= RIO_PORTS) {
+		if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
 			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
 			return -ENXIO;
 		}
@@ -702,7 +702,7 @@
 			p->RIOError.Error = COPYIN_FAILED;
 			return -EFAULT;
 		}
-		if (portStats.port >= RIO_PORTS) {
+		if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
 			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
 			return -ENXIO;
 		}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-16 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-16 15:28 [PATCH] rio: fix array checking Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®