summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2015-02-22 16:45:01 +0100
committerPatrick Georgi <pgeorgi@google.com>2015-02-23 21:59:25 +0100
commit536e560d76157c784683d4aed690c819219afdcc (patch)
tree2cdc1c8e86aca26c9fc15631fad91edb2aa57bcb /payloads/libpayload/drivers/usb
parente6619427854bec4511c94c62d3dec14987030424 (diff)
libpayload: Improve sanity checking in UHCI driver
Test for devno != -1 before trying to access array[devno] (which may be array[-1]). Change-Id: Ia69cc7eba0335f02bb0efec003a320a3c0646acb Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Found-by: Coverity Scan Reviewed-on: http://review.coreboot.org/8509 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/drivers/usb')
-rw-r--r--payloads/libpayload/drivers/usb/uhci_rh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/uhci_rh.c b/payloads/libpayload/drivers/usb/uhci_rh.c
index 4668c4ecae..e08cce1fe1 100644
--- a/payloads/libpayload/drivers/usb/uhci_rh.c
+++ b/payloads/libpayload/drivers/usb/uhci_rh.c
@@ -118,7 +118,7 @@ uhci_rh_scanport (usbdev_t *dev, int port)
return;
}
int devno = RH_INST (dev)->port[offset];
- if ((dev->controller->devices[devno] != 0) && (devno != -1)) {
+ if ((devno != -1) && (dev->controller->devices[devno] != 0)) {
usb_detach_device(dev->controller, devno);
RH_INST (dev)->port[offset] = -1;
}