diff options
author | Peng Fan <peng.fan@nxp.com> | 2016-01-12 15:57:01 +0800 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2016-01-16 07:06:55 +0100 |
commit | 447b9cdf2c4d8d7c6cb1ff64426c1dfaf7396f93 (patch) | |
tree | ebd5fba4a4c40637f72a18cfab100a1d259566b3 | |
parent | 08c11cb5df8c75c79b165e19531040cc36036252 (diff) | |
download | u-boot-imx-447b9cdf2c4d8d7c6cb1ff64426c1dfaf7396f93.zip u-boot-imx-447b9cdf2c4d8d7c6cb1ff64426c1dfaf7396f93.tar.gz u-boot-imx-447b9cdf2c4d8d7c6cb1ff64426c1dfaf7396f93.tar.bz2 |
common: usb: fix checking condition
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@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Paul Kocialkowski <contact@paulk.fr>
Cc: "Stefan BrĂ¼ns" <stefan.bruens@rwth-aachen.de>
Cc: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/usb.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |