From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Jean Delvare <khali@linux-fr.org>,
LMML <linux-media@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH 1/2] [media] dib0700: Drop useless check when remote key is pressed
Date: Mon, 19 Mar 2012 19:26:11 -0300 [thread overview]
Message-ID: <4F67B283.4050308@redhat.com> (raw)
In-Reply-To: <CAGoCfixvanxKT4h1k+FkaYkQ-zHjR-rYBWxHHiDygOScPCeZPA@mail.gmail.com>
Em 13-03-2012 14:57, Devin Heitmueller escreveu:
> On Tue, Mar 13, 2012 at 1:50 PM, Jean Delvare <khali@linux-fr.org> wrote:
>> struct dvb_usb_device *d can never be NULL so don't waste time
>> checking for this.
>>
>> Rationale: the urb's context is set when usb_fill_bulk_urb() is called
>> in dib0700_rc_setup(), and never changes after that. d is dereferenced
>> unconditionally in dib0700_rc_setup() so it can't be NULL or the
>> driver would crash right away.
>>
>> Signed-off-by: Jean Delvare <khali@linux-fr.org>
>> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
>> Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
>> ---
>> Devin, am I missing something?
>
> I think this was just a case of defensive coding where I didn't want
> to dereference something without validating the pointer first (out of
> fear that it got called through some other code path that I didn't
> consider).
>> --- linux-3.3-rc7.orig/drivers/media/dvb/dvb-usb/dib0700_core.c 2012-03-13 11:09:13.000000000 +0100
>> +++ linux-3.3-rc7/drivers/media/dvb/dvb-usb/dib0700_core.c 2012-03-13 18:37:05.785953845 +0100
>> @@ -677,9 +677,6 @@ static void dib0700_rc_urb_completion(st
>> u8 toggle;
>>
>> deb_info("%s()\n", __func__);
>> - if (d == NULL)
>> - return;
>> -
Well, usb_free_urb() is not called when d == NULL, so, if this condition
ever happens, it will keep URB's allocated.
Anyway, if struct dvb_usb_device *d is NULL, the driver has something very
wrong happening on it, and nothing will work on it.
I agree with Jean: it is better to just remove this code there.
Yet, I'd be more happy if Jean's patch could check first if the status is
below 0, in order to prevent a possible race condition at device disconnect.
Regards,
Mauro
next prev parent reply other threads:[~2012-03-19 22:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 17:50 [PATCH 1/2] [media] dib0700: Drop useless check when remote key is pressed Jean Delvare
2012-03-13 17:57 ` Devin Heitmueller
2012-03-19 22:26 ` Mauro Carvalho Chehab [this message]
2012-03-20 7:20 ` Jean Delvare
2012-03-20 12:17 ` Mauro Carvalho Chehab
2012-03-21 20:09 ` Jean Delvare
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=4F67B283.4050308@redhat.com \
--to=mchehab@redhat.com \
--cc=dheitmueller@kernellabs.com \
--cc=khali@linux-fr.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
/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.