libnvdimm: Convert to DEVICE_ATTR_ADMIN_RO()
authorDan Williams <dan.j.williams@intel.com>
Mon, 20 Jul 2020 22:08:13 +0000 (15:08 -0700)
committerVishal Verma <vishal.l.verma@intel.com>
Tue, 28 Jul 2020 18:21:10 +0000 (12:21 -0600)
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>
drivers/nvdimm/namespace_devs.c
drivers/nvdimm/pfn_devs.c
drivers/nvdimm/region_devs.c

index ae155e8..6da67f4 100644 (file)
@@ -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 };
index 34db557..3e11ef8 100644 (file)
@@ -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)
index 4502f9c..20ff30c 100644 (file)
@@ -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)