All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] nvdimm: use the right length of "pmem"
@ 2016-10-29 11:28 ` Nicolas Iooss
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Iooss @ 2016-10-29 11:28 UTC (permalink / raw)
  To: Dan Williams, linux-nvdimm; +Cc: Nicolas Iooss, linux-kernel

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 implementation
for multi-pmem")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 drivers/nvdimm/label.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index fac7cabe8f56..dd615345699f 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -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);
 
-- 
2.10.1

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/1] nvdimm: use the right length of "pmem"
@ 2016-10-29 11:28 ` Nicolas Iooss
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Iooss @ 2016-10-29 11:28 UTC (permalink / raw)
  To: Dan Williams, linux-nvdimm; +Cc: linux-kernel, 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 implementation
for multi-pmem")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 drivers/nvdimm/label.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index fac7cabe8f56..dd615345699f 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -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);
 
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] nvdimm: use the right length of "pmem"
  2016-10-29 11:28 ` Nicolas Iooss
@ 2016-10-30 15:50   ` Dan Williams
  -1 siblings, 0 replies; 6+ messages in thread
From: Dan Williams @ 2016-10-30 15:50 UTC (permalink / raw)
  To: Nicolas Iooss; +Cc: linux-kernel, linux-nvdimm

On Sat, Oct 29, 2016 at 4:28 AM, Nicolas Iooss
<nicolas.iooss_linux@m4x.org> wrote:
> 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 implementation
> for multi-pmem")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

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
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] nvdimm: use the right length of "pmem"
@ 2016-10-30 15:50   ` Dan Williams
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Williams @ 2016-10-30 15:50 UTC (permalink / raw)
  To: Nicolas Iooss; +Cc: linux-nvdimm@lists.01.org, linux-kernel

On Sat, Oct 29, 2016 at 4:28 AM, Nicolas Iooss
<nicolas.iooss_linux@m4x.org> wrote:
> 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 implementation
> for multi-pmem")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] nvdimm: use the right length of "pmem"
  2016-10-30 15:50   ` Dan Williams
@ 2016-10-30 16:57     ` Nicolas Iooss
  -1 siblings, 0 replies; 6+ messages in thread
From: Nicolas Iooss @ 2016-10-30 16:57 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-kernel, linux-nvdimm

On 30/10/16 16:50, Dan Williams wrote:
> On Sat, Oct 29, 2016 at 4:28 AM, Nicolas Iooss
> <nicolas.iooss_linux@m4x.org> wrote:
>> 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 implementation
>> for multi-pmem")
>> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> 
> 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
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] nvdimm: use the right length of "pmem"
@ 2016-10-30 16:57     ` Nicolas Iooss
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Iooss @ 2016-10-30 16:57 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm@lists.01.org, linux-kernel

On 30/10/16 16:50, Dan Williams wrote:
> On Sat, Oct 29, 2016 at 4:28 AM, Nicolas Iooss
> <nicolas.iooss_linux@m4x.org> wrote:
>> 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 implementation
>> for multi-pmem")
>> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-30 16:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-29 11:28 [PATCH 1/1] nvdimm: use the right length of "pmem" Nicolas Iooss
2016-10-29 11:28 ` Nicolas Iooss
2016-10-30 15:50 ` Dan Williams
2016-10-30 15:50   ` Dan Williams
2016-10-30 16:57   ` Nicolas Iooss
2016-10-30 16:57     ` Nicolas Iooss

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.