Linux USB
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Andrey Strachuk <strochuk@ispras.ru>
Cc: Pawel Laszczak <pawell@cadence.com>,
	Roger Quadros <rogerq@kernel.org>,
	Aswath Govindraju <a-govindraju@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: cdns3: removed useless condition in cdns3_gadget_ep_dequeue()
Date: Sat, 16 Jul 2022 20:14:56 +0800	[thread overview]
Message-ID: <20220716121456.GA238342@nchen-desktop> (raw)
In-Reply-To: <20220711151032.16825-1-strochuk@ispras.ru>

On 22-07-11 18:10:32, Andrey Strachuk wrote:
> Comparison of 'ep' with NULL is useless since
> 'ep' is a result of container_of and cannot be NULL
> in any reasonable scenario.
> 

If ep is NULL, the container_of(NULL, struct cdns3_endpoint,
endpoint) will not cause panic, but later ep->desc will cause panic.
So we can't delete the NULL check for ep.

Peter

> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> Fixes: 64b558f597d1 ("usb: cdns3: Change file names for cdns3 driver.")
> ---
>  drivers/usb/cdns3/cdns3-gadget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 5c15c48952a6..f31b389ae0b2 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2608,7 +2608,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep,
>  	unsigned long flags;
>  	int ret = 0;
>  
> -	if (!ep || !request || !ep->desc)
> +	if (!request || !ep->desc)
>  		return -EINVAL;
>  
>  	spin_lock_irqsave(&priv_dev->lock, flags);
> -- 
> 2.25.1
> 

-- 

Thanks,
Peter Chen

      parent reply	other threads:[~2022-07-16 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 15:10 [PATCH] usb: cdns3: removed useless condition in cdns3_gadget_ep_dequeue() Andrey Strachuk
2022-07-14 14:08 ` Greg Kroah-Hartman
2022-07-16 12:14 ` Peter Chen [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=20220716121456.GA238342@nchen-desktop \
    --to=peter.chen@kernel.org \
    --cc=a-govindraju@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=rogerq@kernel.org \
    --cc=strochuk@ispras.ru \
    /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