All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <shuah@kernel.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH] usbip: vudc: check for NULL before use
Date: Tue, 20 Dec 2016 07:31:44 -0700	[thread overview]
Message-ID: <f21975fa-1a59-29cc-843d-550866d55345@kernel.org> (raw)
In-Reply-To: <1482101091-3969-1-git-send-email-sudipm.mukherjee@gmail.com>

On 12/18/2016 03:44 PM, Sudip Mukherjee wrote:
> to_vep() is doing a container_of() on _ep. It is better to do the NULL
> check first and then use it.
> 
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/usb/usbip/vudc_dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
> index 968471b..32ea604 100644
> --- a/drivers/usb/usbip/vudc_dev.c
> +++ b/drivers/usb/usbip/vudc_dev.c
> @@ -388,10 +388,10 @@ static int vep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
>  	unsigned long flags;
>  	int ret = 0;
>  
> -	ep = to_vep(_ep);
>  	if (!_ep)
>  		return -EINVAL;

Hmm. Linus's latest checks _ep and _req. Are you sure you are working
with the latest tree?

>  
> +	ep = to_vep(_ep);
>  	udc = ep_to_vudc(ep);
>  	if (!udc->driver)
>  		return -ESHUTDOWN;
>

thanks,
-- Shuah

  reply	other threads:[~2016-12-20 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 22:44 [PATCH] usbip: vudc: check for NULL before use Sudip Mukherjee
2016-12-20 14:31 ` Shuah Khan [this message]
2016-12-21 13:33   ` Sudip Mukherjee
2016-12-21 14:38     ` Shuah Khan
2016-12-21 15:02       ` Krzysztof Opasiak
2016-12-21 16:11       ` Sudip Mukherjee

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=f21975fa-1a59-29cc-843d-550866d55345@kernel.org \
    --to=shuah@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=valentina.manea.m@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.