diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-10-16 15:28:44 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-16 15:27:54 (GMT) |
commit | 9d90dafdb1f0e3c2b69fa8d3fbe99649127c8fa4 (patch) | |
tree | 1bfc2de4c1bdbccaa4922b15664a9c33919d4570 /drivers/char/rio | |
parent | 51018b0a3160d253283173c2f54f16746cee5852 (diff) | |
download | linux-fsl-qoriq-9d90dafdb1f0e3c2b69fa8d3fbe99649127c8fa4.tar.xz |
[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>
Diffstat (limited to 'drivers/char/rio')
-rw-r--r-- | drivers/char/rio/rioctrl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index 052e812..7ce7761 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c @@ -662,7 +662,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su 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 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su 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; } |