Commit 600aa8d3 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Greg Kroah-Hartman
Browse files

drm/amd/display: 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: default avatarThomas Weißschuh <linux@weissschuh.net>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-drm-v1-5-210f2b36b9bf@weissschuh.net


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2d0f5001
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -614,7 +614,7 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
 *	incorrect/corrupted and we should correct our SRM by getting it from PSP
 */
static ssize_t srm_data_write(struct file *filp, struct kobject *kobj,
			      struct bin_attribute *bin_attr, char *buffer,
			      const struct bin_attribute *bin_attr, char *buffer,
			      loff_t pos, size_t count)
{
	struct hdcp_workqueue *work;
@@ -638,7 +638,7 @@ static ssize_t srm_data_write(struct file *filp, struct kobject *kobj,
}

static ssize_t srm_data_read(struct file *filp, struct kobject *kobj,
			     struct bin_attribute *bin_attr, char *buffer,
			     const struct bin_attribute *bin_attr, char *buffer,
			     loff_t pos, size_t count)
{
	struct hdcp_workqueue *work;
@@ -698,8 +698,8 @@ static ssize_t srm_data_read(struct file *filp, struct kobject *kobj,
static const struct bin_attribute data_attr = {
	.attr = {.name = "hdcp_srm", .mode = 0664},
	.size = PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE, /* Limit SRM size */
	.write = srm_data_write,
	.read = srm_data_read,
	.write_new = srm_data_write,
	.read_new = srm_data_read,
};

struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev,