* [U-Boot] [PATCH] common: usb: fix checking condition
@ 2016-01-12 7:57 Peng Fan
2016-01-12 14:04 ` Marek Vasut
0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan @ 2016-01-12 7:57 UTC (permalink / raw)
To: u-boot
From: Peng Fan <peng.fan@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@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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] common: usb: fix checking condition
2016-01-12 7:57 [U-Boot] [PATCH] common: usb: fix checking condition Peng Fan
@ 2016-01-12 14:04 ` Marek Vasut
0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2016-01-12 14:04 UTC (permalink / raw)
To: u-boot
On Tuesday, January 12, 2016 at 08:57:01 AM, Peng Fan wrote:
> From: Peng Fan <peng.fan@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@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>
Acked-by: Marek Vasut <marex@denx.de>
> ---
> 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;
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-12 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-12 7:57 [U-Boot] [PATCH] common: usb: fix checking condition Peng Fan
2016-01-12 14:04 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox