[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>
This commit is contained in:
parent
51018b0a31
commit
9d90dafdb1
@ -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;
|
p->RIOError.Error = COPYIN_FAILED;
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
if (portStats.port >= RIO_PORTS) {
|
if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
|
||||||
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
|
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
|
||||||
return -ENXIO;
|
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;
|
p->RIOError.Error = COPYIN_FAILED;
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
if (portStats.port >= RIO_PORTS) {
|
if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
|
||||||
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
|
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user