All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Tony Lindgren <tony@atomide.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: Mon, 5 Jun 2017 18:54:50 +0100	[thread overview]
Message-ID: <2ebfaf05-409b-f946-b2ad-f4e81c4439fa@canonical.com> (raw)

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.

Colin.

             reply	other threads:[~2017-06-05 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 17:54 Colin Ian King [this message]
2017-06-06 10:54 ` phy: cpcap-usb: Add CPCAP PMIC USB support Tony Lindgren

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=2ebfaf05-409b-f946-b2ad-f4e81c4439fa@canonical.com \
    --to=colin.king@canonical.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tony@atomide.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.