All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>, "Qiang Yu" <yuq825@gmail.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Xinhui Pan" <Xinhui.Pan@amd.com>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	lima@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org,
	"Thomas Weißschuh" <linux@weissschuh.net>
Subject: Re: [PATCH 3/5] drm/i915: Constify 'struct bin_attribute'
Date: Mon, 16 Dec 2024 13:48:13 +0200	[thread overview]
Message-ID: <87o71bsvb6.fsf@intel.com> (raw)
In-Reply-To: <20241216-sysfs-const-bin_attr-drm-v1-3-210f2b36b9bf@weissschuh.net>

On Mon, 16 Dec 2024, Thomas Weißschuh <linux@weissschuh.net> wrote:
> 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: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c |  8 ++++----
>  drivers/gpu/drm/i915/i915_sysfs.c     | 12 ++++++------
>  2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 71c0daef19962660086b37fe55ca2d6b01f2bb9a..a4cb4e731bdd72201c91541fb86e827e96214a8b 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -2491,7 +2491,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)
>  {
>  
> @@ -2527,7 +2527,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);
> @@ -2543,8 +2543,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)
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 8775beab9cb8438c2e8abb0f9d8104dcba7c0df3..f936e8f1f12942287a5a7d6aa7db6ed3a4c28281 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -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
>  };

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-12-16 11:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 11:34 [PATCH 0/5] drm: Constify 'struct bin_attribute' Thomas Weißschuh
2024-12-16 11:34 ` [PATCH 1/5] drm/sysfs: " Thomas Weißschuh
2024-12-16 11:47   ` Jani Nikula
2025-02-10 17:11   ` Andi Shyti
2024-12-16 11:34 ` [PATCH 2/5] drm/lima: " Thomas Weißschuh
2025-02-10 17:13   ` Andi Shyti
2024-12-16 11:34 ` [PATCH 3/5] drm/i915: " Thomas Weißschuh
2024-12-16 11:48   ` Jani Nikula [this message]
2025-02-10 17:14   ` Andi Shyti
2024-12-16 11:34 ` [PATCH 4/5] drm/amdgpu: " Thomas Weißschuh
2024-12-16 19:53   ` Alex Deucher
2024-12-16 11:34 ` [PATCH 5/5] drm/amd/display: " Thomas Weißschuh
2024-12-16 14:57   ` Harry Wentland
2024-12-16 12:21 ` ✗ Fi.CI.CHECKPATCH: warning for drm: " Patchwork
2024-12-16 12:21 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-12-16 12:44 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-10 16:50 ` [PATCH 0/5] " Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o71bsvb6.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=lima@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=sunpeng.li@amd.com \
    --cc=tursulin@ursulin.net \
    --cc=tzimmermann@suse.de \
    --cc=yuq825@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.