* re: libnvdimm, nfit, nd_blk: driver for BLK-mode access persistent memory
@ 2015-06-30 17:42 Dan Carpenter
2015-06-30 23:07 ` Williams, Dan J
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-06-30 17:42 UTC (permalink / raw)
To: ross.zwisler; +Cc: linux-nvdimm, linux-acpi
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.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: libnvdimm, nfit, nd_blk: driver for BLK-mode access persistent memory
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
0 siblings, 0 replies; 2+ messages in thread
From: Williams, Dan J @ 2015-06-30 23:07 UTC (permalink / raw)
To: dan.carpenter@oracle.com
Cc: ross.zwisler@linux.intel.com, linux-acpi@vger.kernel.org,
linux-nvdimm@ml01.01.org
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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-30 23:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).