common: usb: fix checking condition
PATCH 1/1 common: usb: fix checking condition
From: Peng Fan <[email protected]>
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 <[email protected]>
Cc Simon Glass <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Paul Kocialkowski <[email protected]>
Cc "Stefan Br?ns" <[email protected]>
Cc Vincent Palatin <[email protected]>
--- common/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/usb.c +1 -1
@@ -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 ;
Signature · 1 line
2.6.2
PATCH 1/1 common: usb: fix checking condition
Quoted 6 lines · Peng Fan
From: Peng Fan <[email protected]>
We support max
USB_MAXENDPOINTS, so need to use "epno >=USB_MAXENDPOINTS", but not "epno >USB_MAXENDPOINTS". If use ">", we may exceeds the array ofif_desc->ep_desc.
Quoted 7 lines
Signed-off-by Peng Fan <[email protected]>Cc Simon Glass <[email protected]>Cc Hans de Goede <[email protected]>Cc Marek Vasut <[email protected]>Cc Paul Kocialkowski <[email protected]>Cc "Stefan Br?ns" <[email protected]>Cc Vincent Palatin <[email protected]>
Acked-by Marek Vasut <[email protected]>
Quoted 9 lines
--- common/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/usb.c +0
-0
common/usb.c static int usb_parse_config(struct usb_device *dev, · line 462
Quoted 8 lines
common/usb.c +1
-1@@ -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