[PATCH RFC 0/4] HID: constify static fixed up report descriptors

From: Thomas Weißschuh
Date: Tue Jul 30 2024 - 17:36:35 EST


By allowing the drivers to return a "const *" they can constify their
static report arrays.
This makes it clear to driver authors that the HID core will not modify
those reports and they can be reused for multiple devices.
Furthermore security is slightly improved as those reports are protected
against accidental or malicious modifications.

This is an RFC, only the cmedia driver is updated.
compilation of any other HID driver making use of report_fixup() will fail.

Currently the series would require one big cut-over commit changing the
signatures of all report_fixup() callbacks at once, of which there are
around 50, so it wouldn't be that bad.
All other preparations and actual constifications can be done one a
per-driver basis.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
Thomas Weißschuh (4):
HID: treat fixed up report as const
HID: cmedia: directly return fixed up rdesc
HID: change return type of report_fixup() to const
HID: cmedia: constify fixed up report descriptor

drivers/hid/hid-cmedia.c | 6 +++---
drivers/hid/hid-core.c | 7 ++++---
drivers/hid/hid-sensor-hub.c | 2 +-
include/linux/hid.h | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
---
base-commit: c91a7dee0555f6f9d3702d86312382e4c4729d0a
change-id: 20240730-hid-const-fixup-8b01cbda1b49

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>