* [PATCH] mlxbf-bootctl: Constify 'struct bin_attribute'
@ 2024-12-15 13:25 Thomas Weißschuh
2024-12-16 17:17 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2024-12-15 13:25 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Vadim Pasternak
Cc: platform-driver-x86, linux-kernel, Thomas Weißschuh
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>
---
drivers/platform/mellanox/mlxbf-bootctl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c
index c5b36837e6943ab2cfb8908b03e3d0fe387f2cb0..a2011af48201c6561565920cbac2f18b667c3006 100644
--- a/drivers/platform/mellanox/mlxbf-bootctl.c
+++ b/drivers/platform/mellanox/mlxbf-bootctl.c
@@ -939,7 +939,7 @@ MODULE_DEVICE_TABLE(acpi, mlxbf_bootctl_acpi_ids);
static ssize_t mlxbf_bootctl_bootfifo_read(struct file *filp,
struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t pos,
size_t count)
{
@@ -971,9 +971,9 @@ static ssize_t mlxbf_bootctl_bootfifo_read(struct file *filp,
return p - buf;
}
-static struct bin_attribute mlxbf_bootctl_bootfifo_sysfs_attr = {
+static const struct bin_attribute mlxbf_bootctl_bootfifo_sysfs_attr = {
.attr = { .name = "bootfifo", .mode = 0400 },
- .read = mlxbf_bootctl_bootfifo_read,
+ .read_new = mlxbf_bootctl_bootfifo_read,
};
static bool mlxbf_bootctl_guid_match(const guid_t *guid,
---
base-commit: 2d8308bf5b67dff50262d8a9260a50113b3628c6
change-id: 20241215-sysfs-const-bin_attr-mellanox-3708fb4d0559
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] mlxbf-bootctl: Constify 'struct bin_attribute'
2024-12-15 13:25 [PATCH] mlxbf-bootctl: Constify 'struct bin_attribute' Thomas Weißschuh
@ 2024-12-16 17:17 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2024-12-16 17:17 UTC (permalink / raw)
To: Hans de Goede, Vadim Pasternak, Thomas Weißschuh
Cc: platform-driver-x86, linux-kernel
On Sun, 15 Dec 2024 14:25:40 +0100, Thomas Weißschuh 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.
>
>
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] mlxbf-bootctl: Constify 'struct bin_attribute'
commit: aeb965c0eb8af66777d4bd5a109b92c7a947133f
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-16 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-15 13:25 [PATCH] mlxbf-bootctl: Constify 'struct bin_attribute' Thomas Weißschuh
2024-12-16 17:17 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®