From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-rtc@vger.kernel.org
Subject: Re: [bug report] rtc: m48t59: use generic nvmem
Date: Wed, 21 Feb 2018 15:30:42 +0100 [thread overview]
Message-ID: <20180221143042.GA31244@piout.net> (raw)
In-Reply-To: <20180220090025.GA20051@mwanda>
Hi Dan,
Thanks for the report, I'm fixing up the patch (it uncovered another
issue).
On 20/02/2018 at 12:00:25 +0300, Dan Carpenter wrote:
> Hello Alexandre Belloni,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch ce0e0076da3e: "rtc: m48t59: use generic nvmem" from Feb 12,
> 2018, leads to the following Smatch complaint:
>
> drivers/rtc/rtc-m48t59.c:409 m48t59_rtc_probe()
> warn: variable dereferenced before check 'pdata' (see line 391)
>
> drivers/rtc/rtc-m48t59.c
> 390 .stride = 1,
> 391 .size = pdata->offset,
> ^^^^^^^^^^^^^
> New dereference.
>
> 392 .reg_read = m48t59_nvram_read,
> 393 .reg_write = m48t59_nvram_write,
> 394 .priv = pdev,
> 395 };
> 396
> 397 /* This chip could be memory-mapped or I/O-mapped */
> 398 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> 399 if (!res) {
> 400 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> 401 if (!res)
> 402 return -EINVAL;
> 403 }
> 404
> 405 if (res->flags & IORESOURCE_IO) {
> 406 /* If we are I/O-mapped, the platform should provide
> 407 * the operations accessing chip registers.
> 408 */
> 409 if (!pdata || !pdata->write_byte || !pdata->read_byte)
> ^^^^^
> The existing code assumed "pdata" could be NULL.
>
> 410 return -EINVAL;
> 411 } else if (res->flags & IORESOURCE_MEM) {
>
> regards,
> dan carpenter
--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2018-02-21 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 9:00 [bug report] rtc: m48t59: use generic nvmem Dan Carpenter
2018-02-21 14:30 ` Alexandre Belloni [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=20180221143042.GA31244@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-rtc@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