From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Subject: [PATCH v2 4/6] libnvdimm/namespace: Add debug check while initializing namespace resource size.
Date: Thu, 28 Nov 2019 14:00:55 +0530 [thread overview]
Message-ID: <20191128083057.141425-4-aneesh.kumar@linux.ibm.com> (raw)
In-Reply-To: <20191128083057.141425-1-aneesh.kumar@linux.ibm.com>
This should enable us to catch if we are initializing the namespace with a wrong
size.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
drivers/nvdimm/namespace_devs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 0e4c04765cb8..06b55c41660d 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -967,6 +967,18 @@ static void nd_namespace_pmem_set_resource(struct nd_region *nd_region,
out:
res->start = nd_region->ndr_start + offset;
res->end = res->start + size - 1;
+#ifdef CONFIG_DEBUG_VM
+ if (size) {
+ unsigned long map_size;
+
+ map_size = nvdimm_validate_namespace_size(nd_region, size, arch_namespace_align_size());
+ WARN_ON(map_size);
+
+ map_size = nvdimm_validate_namespace_size(nd_region, res->start, arch_namespace_align_size());
+ WARN_ON(map_size);
+
+ }
+#endif
}
static bool uuid_not_set(const u8 *uuid, struct device *dev, const char *where)
--
2.23.0
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
next prev parent reply other threads:[~2019-11-28 8:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 8:30 [PATCH v2 1/6] libnvdimm/namespace: Make namespace size validation arch dependent Aneesh Kumar K.V
2019-11-28 8:30 ` [PATCH v2 2/6] libnvdimm/namespace: Validate namespace start addr and size Aneesh Kumar K.V
2019-11-28 8:30 ` [PATCH v2 3/6] libnvdimm/namespace: Validate namespace size when creating new namespace Aneesh Kumar K.V
2019-11-28 8:30 ` Aneesh Kumar K.V [this message]
2019-11-28 8:30 ` [PATCH v2 5/6] libnvdimm/namespace: Align DPA based on arch restrictions Aneesh Kumar K.V
2019-11-28 8:30 ` [PATCH v2 6/6] libnvdimm/namespace: Expose arch specific supported size align value Aneesh Kumar K.V
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=20191128083057.141425-4-aneesh.kumar@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=linux-nvdimm@lists.01.org \
/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.