public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] common: usb: fix checking condition
Date: Tue, 12 Jan 2016 15:04:58 +0100	[thread overview]
Message-ID: <201601121504.58229.marex@denx.de> (raw)
In-Reply-To: <1452585421-11106-1-git-send-email-van.freenix@gmail.com>

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

      reply	other threads:[~2016-01-12 14:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  7:57 [U-Boot] [PATCH] common: usb: fix checking condition Peng Fan
2016-01-12 14:04 ` Marek Vasut [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201601121504.58229.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox