lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3501c074cf14f6a671632c6a6aaffe77cc5b9512.camel@intel.com>
Date:   Wed, 7 Nov 2018 23:42:35 +0000
From:   "Williams, Dan J" <dan.j.williams@...el.com>
To:     "linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH 7/8] device-dax: Add support for a dax override driver

On Tue, 2018-10-30 at 20:13 -0700, Dan Williams wrote:
> Introduce the 'new_id' concept for enabling a custom device-driver attach
> policy for dax-bus drivers. The intended use is to have a mechanism for
> hot-plugging device-dax ranges into the page allocator on-demand. With
> this in place the default policy of using device-dax for performance
> differentiated memory can be overridden by user-space policy that can
> arrange for the memory range to be managed as 'System RAM' with
> user-defined NUMA and other performance attributes.
> 
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>
> ---
>  drivers/dax/bus.c    |  145 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  drivers/dax/bus.h    |   10 +++
>  drivers/dax/device.c |   11 ++--
>  3 files changed, 156 insertions(+), 10 deletions(-)
> 
> 

Here's an incremental fixup for the string matching in this patch, I'll
send a v2 if other review comments come in:

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 178d76504f79..17af6fbc3be5 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -39,7 +39,7 @@ static struct dax_id *__dax_match_id(struct dax_device_driver *dax_drv,
 	lockdep_assert_held(&dax_bus_lock);
 
 	list_for_each_entry(dax_id, &dax_drv->ids, list)
-		if (strcmp(dax_id->dev_name, dev_name) == 0)
+		if (sysfs_streq(dax_id->dev_name, dev_name))
 			return dax_id;
 	return NULL;
 }
@@ -60,6 +60,7 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
 {
 	struct dax_device_driver *dax_drv = to_dax_drv(drv);
 	unsigned int region_id, id;
+	char devname[DAX_NAME_LEN];
 	struct dax_id *dax_id;
 	ssize_t rc = count;
 	int fields;
@@ -67,8 +68,8 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
 	fields = sscanf(buf, "dax%d.%d", &region_id, &id);
 	if (fields != 2)
 		return -EINVAL;
-
-	if (strlen(buf) + 1 > DAX_NAME_LEN)
+	sprintf(devname, "dax%d.%d", region_id, id);
+	if (!sysfs_streq(buf, devname))
 		return -EINVAL;
 
 	mutex_lock(&dax_bus_lock);
@@ -99,7 +100,6 @@ static ssize_t new_id_store(struct device_driver *drv, const char *buf,
 }
 static DRIVER_ATTR_WO(new_id);
 
-
 static ssize_t remove_id_store(struct device_driver *drv, const char *buf,
 		size_t count)
 {


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ