Skip to contentSkip to conversation

HID: uclogic: make read-only array reconnect_event static const

PATCH In review Colin Ian King 2 participants 2 messages Jun 19, 2025 – Jun 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: uclogic: make read-only array reconnect_event static const

Don't populate the read-only array reconnect_event on the stack at run time, instead make it static const.

---
 drivers/hid/hid-uclogic-params.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-uclogic-params.c +1 -1
index a6044996abf2..b3d56057cec9 100644
@@ -1341,7 +1341,7 @@ static int uclogic_params_ugee_v2_init_event_hooks(struct hid_device *hdev,
 						   struct uclogic_params *p)
 {
 	struct uclogic_raw_event_hook *event_hook;
-	__u8 reconnect_event[] = {
+	static const __u8 reconnect_event[] = {
 		/* Event received on wireless tablet reconnection */
 		0x02, 0xF8, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 	};
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 13 lines · Colin Ian King

Don't populate the read-only array reconnect_event on the stack at run time, instead make it static const.

---
 drivers/hid/hid-uclogic-params.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-uclogic-params.c +0 -0
index a6044996abf2..b3d56057cec9 100644

drivers/hid/hid-uclogic-params.c static int uclogic_params_ugee_v2_init_event_hooks(struct hid_device *hdev, · line 1346

Quoted 7 lines
drivers/hid/hid-uclogic-params.c +1 -1
@@ -1341,7 +1341,7 @@ static int uclogic_params_ugee_v2_init_event_hooks(struct hid_device *hdev,
 						   struct uclogic_params *p)
 {
 	struct uclogic_raw_event_hook *event_hook;
-	__u8 reconnect_event[] = {
+	static const __u8 reconnect_event[] = {
 		/* Event received on wireless tablet reconnection */
 		0x02, 0xF8, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

Good catch. Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs