Skip to content

Commit

Permalink
libnvdimm: Convert to DEVICE_ATTR_ADMIN_RO()
Browse files Browse the repository at this point in the history
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: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
  • Loading branch information
Dan Williams authored and Vishal Verma committed Jul 28, 2020
1 parent 60d360a commit 5cf81ce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/nvdimm/namespace_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ static ssize_t resource_show(struct device *dev,
return -ENXIO;
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,
4096, 4104, 4160, 4224, 0 };
Expand Down
2 changes: 1 addition & 1 deletion drivers/nvdimm/pfn_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static ssize_t resource_show(struct device *dev,

return rc;
}
static DEVICE_ATTR(resource, 0400, resource_show, NULL);
static DEVICE_ATTR_ADMIN_RO(resource);

static ssize_t size_show(struct device *dev,
struct device_attribute *attr, char *buf)
Expand Down
2 changes: 1 addition & 1 deletion drivers/nvdimm/region_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ static ssize_t resource_show(struct device *dev,

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,
struct device_attribute *attr, char *buf)
Expand Down

0 comments on commit 5cf81ce

Please sign in to comment.