From: Tony Lindgren <tony@atomide.com>
To: Colin Ian King <colin.king@canonical.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: phy: cpcap-usb: Add CPCAP PMIC USB support
Date: Tue, 6 Jun 2017 03:54:18 -0700 [thread overview]
Message-ID: <20170606105418.GA3730@atomide.com> (raw)
In-Reply-To: <2ebfaf05-409b-f946-b2ad-f4e81c4439fa@canonical.com>
* Colin Ian King <colin.king@canonical.com> [170605 10:58]:
> Hi Tony,
>
> While running static analysis on linux-next, CoverityScan picked up a
> NULL pointer deference on ddata->pins when calling pinctrl_lookup_state:
>
> 466 ddata->pins = devm_pinctrl_get(ddata->dev);
>
> 1. Condition IS_ERR(ddata->pins), taking true branch.
>
> 467 if (IS_ERR(ddata->pins)) {
> 468 dev_info(ddata->dev, "default pins not configured:
> %ld\n",
> 469 PTR_ERR(ddata->pins));
>
> 2. assign_zero: Assigning: ddata->pins = NULL.
>
> 470 ddata->pins = NULL;
> 471 }
> 472
>
> CID 1440453 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)3.
> var_deref_model: Passing null pointer ddata->pins to
> pinctrl_lookup_state, which dereferences it. [show details]
>
> 473 ddata->pins_ulpi = pinctrl_lookup_state(ddata->pins, "ulpi");
>
>
> I suspect the IS_ERROR() check should return with some error return
> rather than continuing.
OK thanks for letting me know. I'll take a look and will
send a patch. The pinctrl_lookup_state() probably need to
happen only if ddata->pins as they are optional.
Regards,
Tony
prev parent reply other threads:[~2017-06-06 10:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 17:54 phy: cpcap-usb: Add CPCAP PMIC USB support Colin Ian King
2017-06-06 10:54 ` Tony Lindgren [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=20170606105418.GA3730@atomide.com \
--to=tony@atomide.com \
--cc=andrew@lunn.ch \
--cc=colin.king@canonical.com \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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