mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
drm/i915: Constify 'struct bin_attribute'
The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-drm-v1-3-210f2b36b9bf@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
cf3864d84f
commit
e3626a4565
|
|
@ -2490,7 +2490,7 @@ void i915_gpu_error_debugfs_register(struct drm_i915_private *i915)
|
|||
}
|
||||
|
||||
static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t off, size_t count)
|
||||
{
|
||||
|
||||
|
|
@ -2526,7 +2526,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
|
|||
}
|
||||
|
||||
static ssize_t error_state_write(struct file *file, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t off, size_t count)
|
||||
{
|
||||
struct device *kdev = kobj_to_dev(kobj);
|
||||
|
|
@ -2542,8 +2542,8 @@ static const struct bin_attribute error_state_attr = {
|
|||
.attr.name = "error",
|
||||
.attr.mode = S_IRUSR | S_IWUSR,
|
||||
.size = 0,
|
||||
.read = error_state_read,
|
||||
.write = error_state_write,
|
||||
.read_new = error_state_read,
|
||||
.write_new = error_state_write,
|
||||
};
|
||||
|
||||
void i915_gpu_error_sysfs_setup(struct drm_i915_private *i915)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static int l3_access_valid(struct drm_i915_private *i915, loff_t offset)
|
|||
|
||||
static ssize_t
|
||||
i915_l3_read(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t offset, size_t count)
|
||||
{
|
||||
struct device *kdev = kobj_to_dev(kobj);
|
||||
|
|
@ -88,7 +88,7 @@ i915_l3_read(struct file *filp, struct kobject *kobj,
|
|||
|
||||
static ssize_t
|
||||
i915_l3_write(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t offset, size_t count)
|
||||
{
|
||||
struct device *kdev = kobj_to_dev(kobj);
|
||||
|
|
@ -140,8 +140,8 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
|
|||
static const struct bin_attribute dpf_attrs = {
|
||||
.attr = {.name = "l3_parity", .mode = (S_IRUSR | S_IWUSR)},
|
||||
.size = GEN7_L3LOG_SIZE,
|
||||
.read = i915_l3_read,
|
||||
.write = i915_l3_write,
|
||||
.read_new = i915_l3_read,
|
||||
.write_new = i915_l3_write,
|
||||
.mmap = NULL,
|
||||
.private = (void *)0
|
||||
};
|
||||
|
|
@ -149,8 +149,8 @@ static const struct bin_attribute dpf_attrs = {
|
|||
static const struct bin_attribute dpf_attrs_1 = {
|
||||
.attr = {.name = "l3_parity_slice_1", .mode = (S_IRUSR | S_IWUSR)},
|
||||
.size = GEN7_L3LOG_SIZE,
|
||||
.read = i915_l3_read,
|
||||
.write = i915_l3_write,
|
||||
.read_new = i915_l3_read,
|
||||
.write_new = i915_l3_write,
|
||||
.mmap = NULL,
|
||||
.private = (void *)1
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user