[U-Boot] [PATCH] common: usb: fix checking condition
Peng Fan
van.freenix at gmail.com
Tue Jan 12 08:57:01 CET 2016
From: Peng Fan <peng.fan at nxp.com>
We support max USB_MAXENDPOINTS, so need to use
"epno >= USB_MAXENDPOINTS", but not "epno > USB_MAXENDPOINTS".
If use ">", we may exceeds the array of if_desc->ep_desc.
Signed-off-by: Peng Fan <peng.fan at nxp.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Hans de Goede <hdegoede at redhat.com>
Cc: Marek Vasut <marex at denx.de>
Cc: Paul Kocialkowski <contact at paulk.fr>
Cc: "Stefan Brüns" <stefan.bruens at rwth-aachen.de>
Cc: Vincent Palatin <vpalatin at chromium.org>
---
common/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/usb.c b/common/usb.c
index 9f67cc1..c7b8b0e 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -456,7 +456,7 @@ static int usb_parse_config(struct usb_device *dev,
}
epno = dev->config.if_desc[ifno].no_of_ep;
if_desc = &dev->config.if_desc[ifno];
- if (epno > USB_MAXENDPOINTS) {
+ if (epno >= USB_MAXENDPOINTS) {
printf("Interface %d has too many endpoints!\n",
if_desc->desc.bInterfaceNumber);
return -EINVAL;
--
2.6.2
More information about the U-Boot
mailing list