[PATCH 0/4] power: supply: constify 'struct bin_attribute'

Thomas Weißschuh posted 4 patches 1 year, 2 months ago
drivers/power/supply/ds2760_battery.c |  8 ++++----
drivers/power/supply/ds2780_battery.c | 24 ++++++++++++------------
drivers/power/supply/ds2781_battery.c | 24 ++++++++++++------------
drivers/power/supply/olpc_battery.c   | 11 +++++------
4 files changed, 33 insertions(+), 34 deletions(-)
[PATCH 0/4] power: supply: constify 'struct bin_attribute'
Posted by Thomas Weißschuh 1 year, 2 months ago
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.

The usage of read_new/write_new/bin_attrs_new is a transition mechanism
and will be reverted after the transition is complete.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (4):
      power: supply: ds2760: constify 'struct bin_attribute'
      power: supply: ds2780: constify 'struct bin_attribute'
      power: supply: ds2781: constify 'struct bin_attribute'
      power: supply: olpc_battery: constify 'struct bin_attribute'

 drivers/power/supply/ds2760_battery.c |  8 ++++----
 drivers/power/supply/ds2780_battery.c | 24 ++++++++++++------------
 drivers/power/supply/ds2781_battery.c | 24 ++++++++++++------------
 drivers/power/supply/olpc_battery.c   | 11 +++++------
 4 files changed, 33 insertions(+), 34 deletions(-)
---
base-commit: e70140ba0d2b1a30467d4af6bcfe761327b9ec95
change-id: 20241201-sysfs-const-bin_attr-psy-b6b95490c82b

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/4] power: supply: constify 'struct bin_attribute'
Posted by Sebastian Reichel 1 year, 2 months ago
On Mon, 02 Dec 2024 20:02:18 +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.
> 
> The usage of read_new/write_new/bin_attrs_new is a transition mechanism
> and will be reverted after the transition is complete.
> 
> [...]

Applied, thanks!

[1/4] power: supply: ds2760: constify 'struct bin_attribute'
      commit: fc197588917bb05252115c9e76f3d34d30600249
[2/4] power: supply: ds2780: constify 'struct bin_attribute'
      commit: 9aae72fe40f06872ae20c0cdb545ea5ecc840842
[3/4] power: supply: ds2781: constify 'struct bin_attribute'
      commit: 8159fcb12862f826a26964d8b814ad33e69ba4de
[4/4] power: supply: olpc_battery: constify 'struct bin_attribute'
      commit: dc509d8be38ffe4ff6d752bdb7913718318e83cd

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>