From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756588AbcJ2L3M (ORCPT ); Sat, 29 Oct 2016 07:29:12 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:58281 "EHLO mx1.polytechnique.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755258AbcJ2L3K (ORCPT ); Sat, 29 Oct 2016 07:29:10 -0400 From: Nicolas Iooss To: Dan Williams , linux-nvdimm@ml01.01.org Cc: linux-kernel@vger.kernel.org, Nicolas Iooss Subject: [PATCH 1/1] nvdimm: use the right length of "pmem" Date: Sat, 29 Oct 2016 13:28:52 +0200 Message-Id: <20161029112852.19975-1-nicolas.iooss_linux@m4x.org> X-Mailer: git-send-email 2.10.1 X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sat Oct 29 13:29:06 2016 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.000181, queueID=CFF88564836 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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