From: Peng Fan Date: Tue, 12 Jan 2016 07:57:01 +0000 (+0800) Subject: common: usb: fix checking condition X-Git-Tag: v2016.03-rc1~301 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=447b9cdf2c4d8d7c6cb1ff64426c1dfaf7396f93;p=platform%2Fkernel%2Fu-boot.git 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 Cc: Simon Glass Cc: Hans de Goede Cc: Marek Vasut Cc: Paul Kocialkowski Cc: "Stefan BrĂ¼ns" Cc: Vincent Palatin --- 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;