public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations
@ 2026-05-25 12:35 Christophe JAILLET
  2026-05-25 21:15 ` Claude review: " Claude Code Review Bot
  2026-05-25 21:15 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2026-05-25 12:35 UTC (permalink / raw)
  To: Matthew Brost, Thomas Hellström, Rodrigo Vivi, David Airlie,
	Simona Vetter
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, intel-xe,
	dri-devel

'struct configfs_item_operations' and 'configfs_group_operations' are not
modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  34095	  15704	    128	  49927	   c307	drivers/gpu/drm/xe/xe_configfs.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  34447	  15352	    128	  49927	   c307	drivers/gpu/drm/xe/xe_configfs.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/gpu/drm/xe/xe_configfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 32102600a148..5c2072f18a57 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -838,7 +838,7 @@ static void xe_config_device_release(struct config_item *item)
 	kfree(dev);
 }
 
-static struct configfs_item_operations xe_config_device_ops = {
+static const struct configfs_item_operations xe_config_device_ops = {
 	.release	= xe_config_device_release,
 };
 
@@ -855,7 +855,7 @@ static bool xe_config_device_is_visible(struct config_item *item,
 	return true;
 }
 
-static struct configfs_group_operations xe_config_device_group_ops = {
+static const struct configfs_group_operations xe_config_device_group_ops = {
 	.is_visible	= xe_config_device_is_visible,
 };
 
@@ -950,7 +950,7 @@ static bool xe_config_sriov_is_visible(struct config_item *item,
 	return true;
 }
 
-static struct configfs_group_operations xe_config_sriov_group_ops = {
+static const struct configfs_group_operations xe_config_sriov_group_ops = {
 	.is_visible	= xe_config_sriov_is_visible,
 };
 
@@ -1054,7 +1054,7 @@ static struct config_group *xe_config_make_device_group(struct config_group *gro
 	return &dev->group;
 }
 
-static struct configfs_group_operations xe_config_group_ops = {
+static const struct configfs_group_operations xe_config_group_ops = {
 	.make_group	= xe_config_make_device_group,
 };
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Claude review: drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations
  2026-05-25 12:35 [PATCH] drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
@ 2026-05-25 21:15 ` Claude Code Review Bot
  2026-05-25 21:15 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 21:15 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Patches: 1
Reviewed: 2026-05-26T07:15:36.944927

---

This is a single-patch series that adds `const` qualifiers to four `configfs_item_operations` and `configfs_group_operations` struct instances in the Xe DRM configfs driver. The change is straightforward, correct, and follows a well-established kernel hardening pattern.

**Verdict: Looks good.** No issues found.

The `struct config_item_type` in `include/linux/configfs.h` already declares its `ct_item_ops` and `ct_group_ops` members as `const` pointers (line 67-68), so the structures were always intended to be const-qualified. The commit message is well-structured with before/after size data showing the expected shift from `.data` to `.text` (352 bytes moved to read-only), and the total object size remains unchanged.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Claude review: drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations
  2026-05-25 12:35 [PATCH] drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
  2026-05-25 21:15 ` Claude review: " Claude Code Review Bot
@ 2026-05-25 21:15 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 21:15 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Status: Clean**

All four changes follow the same pattern — adding `const` to a `static struct` that is only ever assigned to a `const`-qualified pointer field:

1. `xe_config_device_ops` (line 101→102): `configfs_item_operations`, assigned to `ct_item_ops` which is `const struct configfs_item_operations *` — correct.

2. `xe_config_device_group_ops` (line 110→111): `configfs_group_operations`, assigned to `ct_group_ops` which is `const struct configfs_group_operations *` — correct.

3. `xe_config_sriov_group_ops` (line 119→120): Same pattern — correct.

4. `xe_config_group_ops` (line 128→129): Same pattern — correct.

The structures contain only function pointers (`.release`, `.is_visible`, `.make_group`) that are never modified after initialization, so constifying them is safe and moves these function pointers into a read-only section, providing a minor hardening benefit against write-what-where exploits.

No functional change. The commit message accurately describes the motivation and includes size data. Nothing to flag.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-25 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25 12:35 [PATCH] drm/xe/configfs: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
2026-05-25 21:15 ` Claude review: " Claude Code Review Bot
2026-05-25 21:15 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox