Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] rio: fix array checking

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

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Alan Cox and committed by
Linus Torvalds
9d90dafd 51018b0a

+2 -2
+2 -2
drivers/char/rio/rioctrl.c
··· 662 662 p->RIOError.Error = COPYIN_FAILED; 663 663 return -EFAULT; 664 664 } 665 - if (portStats.port >= RIO_PORTS) { 665 + if (portStats.port < 0 || portStats.port >= RIO_PORTS) { 666 666 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 667 667 return -ENXIO; 668 668 } ··· 702 702 p->RIOError.Error = COPYIN_FAILED; 703 703 return -EFAULT; 704 704 } 705 - if (portStats.port >= RIO_PORTS) { 705 + if (portStats.port < 0 || portStats.port >= RIO_PORTS) { 706 706 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 707 707 return -ENXIO; 708 708 }