Commit 5cf81ce1 authored by Dan Williams's avatar Dan Williams Committed by Vishal Verma

libnvdimm: Convert to DEVICE_ATTR_ADMIN_RO()

Move libnvdimm sysfs attributes that currently use an open coded
DEVICE_ATTR() to hide sensitive root-only information (physical memory
layout) to the new DEVICE_ATTR_ADMIN_RO() helper.

Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarVishal Verma <vishal.l.verma@intel.com>
parent 60d360ac
...@@ -1309,7 +1309,7 @@ static ssize_t resource_show(struct device *dev, ...@@ -1309,7 +1309,7 @@ static ssize_t resource_show(struct device *dev,
return -ENXIO; return -ENXIO;
return sprintf(buf, "%#llx\n", (unsigned long long) res->start); return sprintf(buf, "%#llx\n", (unsigned long long) res->start);
} }
static DEVICE_ATTR(resource, 0400, resource_show, NULL); static DEVICE_ATTR_ADMIN_RO(resource);
static const unsigned long blk_lbasize_supported[] = { 512, 520, 528, static const unsigned long blk_lbasize_supported[] = { 512, 520, 528,
4096, 4104, 4160, 4224, 0 }; 4096, 4104, 4160, 4224, 0 };
......
...@@ -218,7 +218,7 @@ static ssize_t resource_show(struct device *dev, ...@@ -218,7 +218,7 @@ static ssize_t resource_show(struct device *dev,
return rc; return rc;
} }
static DEVICE_ATTR(resource, 0400, resource_show, NULL); static DEVICE_ATTR_ADMIN_RO(resource);
static ssize_t size_show(struct device *dev, static ssize_t size_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
......
...@@ -605,7 +605,7 @@ static ssize_t resource_show(struct device *dev, ...@@ -605,7 +605,7 @@ static ssize_t resource_show(struct device *dev,
return sprintf(buf, "%#llx\n", nd_region->ndr_start); return sprintf(buf, "%#llx\n", nd_region->ndr_start);
} }
static DEVICE_ATTR(resource, 0400, resource_show, NULL); static DEVICE_ATTR_ADMIN_RO(resource);
static ssize_t persistence_domain_show(struct device *dev, static ssize_t persistence_domain_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment