nvdimm: use the right length of "pmem"
PATCH 1/1 nvdimm: use the right length of "pmem"
In order to test that the name of a resource begins with "pmem", call strncmp() with 4 as length instead of 3 to match the whole prefix.
for multi-pmem")
--- drivers/nvdimm/label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvdimm/label.c +1 -1
@@ -938,7 +938,7 @@ int nd_pmem_namespace_label_update(struct nd_region *nd_region, }for_each_dpa_resource (ndd, res) -if (strncmp (res->name,"pmem" ,3 ) ==0 ) +if (strncmp (res->name,"pmem" ,4 ) ==0 ) count++;WARN_ON_ONCE (!count);
Signature · 6 lines
2.10.1 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 6 lines · Nicolas Iooss
In order to test that the name of a resource begins with "pmem", call
strncmp()with 4 as length instead of 3 to match the whole prefix.Fixes 16660eaea0cc ("libnvdimm, namespace: update label implementationfor multi-pmem")
Signed-off-by Nicolas Iooss <[email protected]>
Thanks, although I would not call this out as a fix since the length parameter could be 1 and still do the right thing. I.e. we're distinguishing "blk" from "pmem" resources. I'll add this for 4.10 as a cleanup.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 5 lines · Dan Williams
Quoted 3 lines · Nicolas Iooss
In order to test that the name of a resource begins with "pmem", call
strncmp()with 4 as length instead of 3 to match the whole prefix.
Quoted 8 lines
Quoted 3 lines
Fixes 16660eaea0cc ("libnvdimm, namespace: update label implementationfor multi-pmem")
Signed-off-by Nicolas Iooss <[email protected]>Thanks, although I would not call this out as a fix since the length parameter could be 1 and still do the right thing. I.e. we're distinguishing "blk" from "pmem" resources. I'll add this for 4.10 as a cleanup.
All right. Thanks for your quick reply!
Nicolas
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm