From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: smatch: leds: potential null deref
Date: Wed, 07 Apr 2010 09:18:50 +0000 [thread overview]
Message-ID: <20100407091850.GB5157@bicker> (raw)
Hello,
Smatch complains about a potential null dereference but I don't know how
to fix it. Could you take a look?
drivers/leds/leds-88pm860x.c +269 pm860x_led_probe(28)
error: potential null derefence 'pdata'.
256 if (pdev->dev.parent->platform_data) {
257 pm860x_pdata = pdev->dev.parent->platform_data;
258 pdata = pm860x_pdata->led;
259 } else
260 pdata = NULL;
^^^^^^^^^^^^^
We set pdata to NULL here.
261
262 data = kzalloc(sizeof(struct pm860x_led), GFP_KERNEL);
263 if (data = NULL)
264 return -ENOMEM;
265 strncpy(data->name, res->name, MFD_NAME_SIZE);
266 dev_set_drvdata(&pdev->dev, data);
267 data->chip = chip;
268 data->i2c = (chip->id = CHIP_PM8606) ? chip->client : chip->companion;
269 data->iset = pdata->iset;
^^^^^^^^^^^^
We dereference it here.
regards,
dan carpenter
next reply other threads:[~2010-04-07 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 9:18 Dan Carpenter [this message]
2010-04-07 9:44 ` smatch: leds: potential null deref Dan Carpenter
2010-04-09 10:14 ` Haojian Zhuang
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=20100407091850.GB5157@bicker \
--to=error27@gmail.com \
--cc=kernel-janitors@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