From: "Williams, Dan J" <dan.j.williams@intel.com>
To: "dan.carpenter@oracle.com" <dan.carpenter@oracle.com>
Cc: "ross.zwisler@linux.intel.com" <ross.zwisler@linux.intel.com>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-nvdimm@ml01.01.org" <linux-nvdimm@ml01.01.org>
Subject: Re: libnvdimm, nfit, nd_blk: driver for BLK-mode access persistent memory
Date: Tue, 30 Jun 2015 23:07:37 +0000 [thread overview]
Message-ID: <1435705653.18090.69.camel@intel.com> (raw)
In-Reply-To: <20150630174222.GA30796@mwanda>
On Tue, 2015-06-30 at 20:42 +0300, Dan Carpenter wrote:
> Hello Ross Zwisler,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 047fc8a1f9a6: "libnvdimm, nfit, nd_blk: driver for BLK-mode
> access persistent memory" from Jun 25, 2015, leads to the following
> Smatch complaint:
>
> drivers/acpi/nfit.c:1224 acpi_nfit_blk_region_enable()
> error: we previously assumed 'nfit_mem' could be null (see line 1223)
>
> drivers/acpi/nfit.c
> 1222 nfit_mem = nvdimm_provider_data(nvdimm);
> 1223 if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) {
> ^^^^^^^^
> Check.
>
> 1224 dev_dbg(dev, "%s: missing%s%s%s\n", __func__,
> 1225 nfit_mem ? "" : " nfit_mem",
> 1226 nfit_mem->dcr ? "" : " dcr",
> ^^^^^^^^^^^^^
> Unchecked dereference.
Thanks Dan!
8<-----
nfit: fix smatch "use after null check" report
From: Dan Williams <dan.j.williams@intel.com>
drivers/acpi/nfit.c:1224 acpi_nfit_blk_region_enable()
error: we previously assumed 'nfit_mem' could be null (see line 1223)
drivers/acpi/nfit.c
1222 nfit_mem = nvdimm_provider_data(nvdimm);
1223 if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) {
^^^^^^^^
Check.
1224 dev_dbg(dev, "%s: missing%s%s%s\n", __func__,
1225 nfit_mem ? "" : " nfit_mem",
1226 nfit_mem->dcr ? "" : " dcr",
^^^^^^^^^^^^^
Unchecked dereference.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/acpi/nfit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 2161fa178c8d..a20b7c883ca0 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -1223,8 +1223,8 @@ static int acpi_nfit_blk_region_enable(struct nvdimm_bus *nvdimm_bus,
if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) {
dev_dbg(dev, "%s: missing%s%s%s\n", __func__,
nfit_mem ? "" : " nfit_mem",
- nfit_mem->dcr ? "" : " dcr",
- nfit_mem->bdw ? "" : " bdw");
+ (nfit_mem && nfit_mem->dcr) ? "" : " dcr",
+ (nfit_mem && nfit_mem->bdw) ? "" : " bdw");
return -ENXIO;
}
prev parent reply other threads:[~2015-06-30 23:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 17:42 libnvdimm, nfit, nd_blk: driver for BLK-mode access persistent memory Dan Carpenter
2015-06-30 23:07 ` Williams, Dan J [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=1435705653.18090.69.camel@intel.com \
--to=dan.j.williams@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-nvdimm@ml01.01.org \
--cc=ross.zwisler@linux.intel.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.