public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Corentin LABBE <clabbe.montjoie@gmail.com>
Cc: <gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>
Subject: Re: [PATCH] usb: phy: msm: fix a possible NULL dereference
Date: Mon, 16 Nov 2015 13:23:01 -0600	[thread overview]
Message-ID: <87mvudlpey.fsf@saruman.tx.rr.com> (raw)
In-Reply-To: <564A2C0E.70305@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]


Hi,

(you need to break your lines at 80 characters)

Corentin LABBE <clabbe.montjoie@gmail.com> writes:
> Le 16/11/2015 18:07, Felipe Balbi a écrit :
>> 
>> Hi,
>> 
>> LABBE Corentin <clabbe.montjoie@gmail.com> writes:
>>> of_match_device could return NULL, and so cause a NULL pointer
>>> dereference later. Renaming id to of_id (like all others do) in the
>>> process.
>>>
>>> Reported-by: coverity (CID 1324133)
>>> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
>>> ---
>>>  drivers/usb/phy/phy-msm-usb.c | 9 ++++++---
>>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
>>> index 80eb991..c4a66cf 100644
>>> --- a/drivers/usb/phy/phy-msm-usb.c
>>> +++ b/drivers/usb/phy/phy-msm-usb.c
>>> @@ -1506,20 +1506,23 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
>>>  {
>>>  	struct msm_otg_platform_data *pdata;
>>>  	struct extcon_dev *ext_id, *ext_vbus;
>>> -	const struct of_device_id *id;
>>> +	const struct of_device_id *of_id;
>> 
>> and why did you need to rename this variable ? Please resend without the
>> variable rename.
>> 
>
> I was renaming because all other drivers call it of_id, but I got hint
> from another thread to use of_device_get_match_data() which will
> permit to remove that variable, and still solve the issue.

for -rc we usually want the smallest patch needed to fix the issue. That
would be the two line if() condition. If converting to
of_device_get_match_data() is about the same (2 or 3 lines), then it
should be fine; but as a general rule of thumb: we don't fix and
cleanup/refactor on the same patch unless strictly necessary.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      reply	other threads:[~2015-11-16 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  7:45 [PATCH] usb: phy: msm: fix a possible NULL dereference LABBE Corentin
2015-11-16 17:07 ` Felipe Balbi
2015-11-16 19:18   ` Corentin LABBE
2015-11-16 19:23     ` Felipe Balbi [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=87mvudlpey.fsf@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox