From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Fri, 22 Sep 2017 06:59:19 +0200 Subject: [U-Boot] [PATCH 04/14] usb: Handle audio extension endpoint descriptor in usb_parse_config() In-Reply-To: <1505742050-5697-5-git-send-email-bmeng.cn@gmail.com> References: <1505742050-5697-1-git-send-email-bmeng.cn@gmail.com> <1505742050-5697-5-git-send-email-bmeng.cn@gmail.com> Message-ID: <09edd6e7-a2c1-0747-83d1-abf4b98f5dbd@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 18.09.2017 15:40, Bin Meng wrote: > Normal endpoint descriptor size is 7, but for audio extension it is > 9. Handle that correctly when parsing endpoint descriptor. > > Signed-off-by: Bin Meng > --- > > common/usb.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/common/usb.c b/common/usb.c > index 0904259..6cb92ef 100644 > --- a/common/usb.c > +++ b/common/usb.c > @@ -437,12 +437,13 @@ static int usb_parse_config(struct usb_device *dev, > } > break; > case USB_DT_ENDPOINT: > - if (head->bLength != USB_DT_ENDPOINT_SIZE) { > + if (head->bLength != USB_DT_ENDPOINT_SIZE && > + head->bLength != USB_DT_ENDPOINT_AUDIO_SIZE) { > printf("ERROR: Invalid USB EP length (%d)\n", > head->bLength); > break; > } > - if (index + USB_DT_ENDPOINT_SIZE > > + if (index + head->bLength > > dev->config.desc.wTotalLength) { > puts("USB EP descriptor overflowed buffer!\n"); > break; > Reviewed-by: Stefan Roese Tested-by: Stefan Roese Thanks, Stefan