Skip to content

Commit 5cf81ce

Browse files
djbwstellarhopper
authored andcommitted
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 <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Ira Weiny <[email protected]> Signed-off-by: Dan Williams <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 60d360a commit 5cf81ce

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/nvdimm/namespace_devs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ static ssize_t resource_show(struct device *dev,
13091309
return -ENXIO;
13101310
return sprintf(buf, "%#llx\n", (unsigned long long) res->start);
13111311
}
1312-
static DEVICE_ATTR(resource, 0400, resource_show, NULL);
1312+
static DEVICE_ATTR_ADMIN_RO(resource);
13131313

13141314
static const unsigned long blk_lbasize_supported[] = { 512, 520, 528,
13151315
4096, 4104, 4160, 4224, 0 };

drivers/nvdimm/pfn_devs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static ssize_t resource_show(struct device *dev,
218218

219219
return rc;
220220
}
221-
static DEVICE_ATTR(resource, 0400, resource_show, NULL);
221+
static DEVICE_ATTR_ADMIN_RO(resource);
222222

223223
static ssize_t size_show(struct device *dev,
224224
struct device_attribute *attr, char *buf)

drivers/nvdimm/region_devs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ static ssize_t resource_show(struct device *dev,
605605

606606
return sprintf(buf, "%#llx\n", nd_region->ndr_start);
607607
}
608-
static DEVICE_ATTR(resource, 0400, resource_show, NULL);
608+
static DEVICE_ATTR_ADMIN_RO(resource);
609609

610610
static ssize_t persistence_domain_show(struct device *dev,
611611
struct device_attribute *attr, char *buf)

0 commit comments

Comments
 (0)