mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
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>
This commit is contained in:
@@ -456,7 +456,7 @@ static int usb_parse_config(struct usb_device *dev,
|
|||||||
}
|
}
|
||||||
epno = dev->config.if_desc[ifno].no_of_ep;
|
epno = dev->config.if_desc[ifno].no_of_ep;
|
||||||
if_desc = &dev->config.if_desc[ifno];
|
if_desc = &dev->config.if_desc[ifno];
|
||||||
if (epno > USB_MAXENDPOINTS) {
|
if (epno >= USB_MAXENDPOINTS) {
|
||||||
printf("Interface %d has too many endpoints!\n",
|
printf("Interface %d has too many endpoints!\n",
|
||||||
if_desc->desc.bInterfaceNumber);
|
if_desc->desc.bInterfaceNumber);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
Reference in New Issue
Block a user