Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1545799

Re: [PATCH] usbip: vudc: check for NULL before use

From Shuah Khan <shuahkhan@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usbip: vudc: check for NULL before use
Date 2016-12-21 15:40 +0100
Message-ID <sQQdI-4Cy-39@gated-at.bofh.it> (permalink)
References <sPSrg-7RA-19@gated-at.bofh.it> <sQtKa-6MJ-5@gated-at.bofh.it> <sQPhD-43Z-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Sudip,

On Wed, Dec 21, 2016 at 6:33 AM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> On Tue, Dec 20, 2016 at 07:31:44AM -0700, Shuah Khan wrote:
>> 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?
>
> I checked with next-20161221 and its still there.

This is for  vep_dequeue() - Are you sure both linux-next and Linus's tree show
the following:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/usbip/vudc_dev.c

static int vep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{
struct vep *ep;
struct vrequest *req;
struct vudc *udc;
struct vrequest *lst;
unsigned long flags;
int ret = -EINVAL;

if (!_ep || !_req)
return ret;

ep = to_vep(_ep);
req = to_vrequest(_req);
udc = req->udc;

if (!udc->driver)
return -ESHUTDOWN;

There are other routines in this file that don't check null. I am confused.

thanks,
-- Shuah

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] usbip: vudc: check for NULL before use Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-12-18 23:50 +0100
  Re: [PATCH] usbip: vudc: check for NULL before use Shuah Khan <shuah@kernel.org> - 2016-12-20 15:40 +0100
    Re: [PATCH] usbip: vudc: check for NULL before use Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-12-21 14:40 +0100
      Re: [PATCH] usbip: vudc: check for NULL before use Shuah Khan <shuahkhan@gmail.com> - 2016-12-21 15:40 +0100
        Re: [PATCH] usbip: vudc: check for NULL before use Krzysztof Opasiak <k.opasiak@samsung.com> - 2016-12-21 16:10 +0100
        Re: [PATCH] usbip: vudc: check for NULL before use Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-12-21 17:30 +0100

csiph-web