Skip to contentSkip to conversation

FROMLIST: HID: nintendo: fix flexible_array.cocci warnings

PATCH In review Julia Lawall 3 participants 4 messages May 14, 2021

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

PATCH 1/1 FROMLIST: HID: nintendo: fix flexible_array.cocci warnings

Zero-length and one-element arrays are deprecated, see Documentation/process/deprecated.rst Flexible-array members should be used instead.

Generated by: scripts/coccinelle/misc/flexible_array.cocci

Fixes f4dc6237a840 ("FROMLIST: HID: nintendo: add nintendo switch controller driver")
CC Daniel J. Ogorchock <[email protected]>

---

tree:   https://git.linaro.org/people/lee.jones/linux.git aosp-android-mainline-tracking
head:   9b2a8deb96b1f9d4cc52497c4559f187db0408e1
commit: f4dc6237a840e52e0ecd3c46393af5b98029f650 [307/599] FROMLIST: HID: nintendo: add nintendo switch controller driver

:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago

Please take the patch only if it's a positive warning. Thanks!

 hid-nintendo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +2 -2
@@ -152,13 +152,13 @@ struct joycon_subcmd_request {
 	u8 packet_num; /* incremented every send */
 	u8 rumble_data[8];
 	u8 subcmd_id;
-	u8 data[0]; /* length depends on the subcommand */
+	u8 data[]; /* length depends on the subcommand */
 } __packed;
 
 struct joycon_subcmd_reply {
 	u8 ack; /* MSB 1 for ACK, 0 for NACK */
 	u8 id; /* id of requested subcmd */
-	u8 data[0]; /* will be at most 35 bytes */
+	u8 data[]; /* will be at most 35 bytes */
 } __packed;
 
 struct joycon_input_report {
#1 lore raw
Quoted 6 lines · Julia Lawall

Zero-length and one-element arrays are deprecated, see Documentation/process/deprecated.rst Flexible-array members should be used instead.

Generated by: scripts/coccinelle/misc/flexible_array.cocci

Quoted 8 lines
Fixes f4dc6237a840 ("FROMLIST: HID: nintendo: add nintendo switch controller driver")
CC Daniel J. Ogorchock <[email protected]>

---

tree: https://git.linaro.org/people/lee.jones/linux.git aosp-android-mainline-tracking

Please refrain from sending patches based on this tree.

It's mainly used for hacking.

Quoted 28 lines
head:   9b2a8deb96b1f9d4cc52497c4559f187db0408e1
commit: f4dc6237a840e52e0ecd3c46393af5b98029f650 [307/599] FROMLIST: HID: nintendo: add nintendo switch controller driver

:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago

Please take the patch only if it's a positive warning. Thanks!

 hid-nintendo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +2 -2
@@ -152,13 +152,13 @@ struct joycon_subcmd_request {
 	u8 packet_num; /* incremented every send */
 	u8 rumble_data[8];
 	u8 subcmd_id;
-	u8 data[0]; /* length depends on the subcommand */
+	u8 data[]; /* length depends on the subcommand */
 } __packed;
 
 struct joycon_subcmd_reply {
 	u8 ack; /* MSB 1 for ACK, 0 for NACK */
 	u8 id; /* id of requested subcmd */
-	u8 data[0]; /* will be at most 35 bytes */
+	u8 data[]; /* will be at most 35 bytes */
 } __packed;
 
 struct joycon_input_report {
Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 15 lines · Lee Jones
Quoted 13 lines · Julia Lawall

Zero-length and one-element arrays are deprecated, see Documentation/process/deprecated.rst Flexible-array members should be used instead.

Generated by: scripts/coccinelle/misc/flexible_array.cocci

Fixes f4dc6237a840 ("FROMLIST: HID: nintendo: add nintendo switch controller driver")
CC Daniel J. Ogorchock <[email protected]>

---

Quoted 5 lines
Quoted 1 line

tree: https://git.linaro.org/people/lee.jones/linux.git aosp-android-mainline-tracking

Please refrain from sending patches based on this tree.

It's mainly used for hacking.

OK, I guess that the 0-day people will notice this and remove it from the list of checked trees.

julia

Quoted 36 lines
Quoted 19 lines
head:   9b2a8deb96b1f9d4cc52497c4559f187db0408e1
commit: f4dc6237a840e52e0ecd3c46393af5b98029f650 [307/599] FROMLIST: HID: nintendo: add nintendo switch controller driver

:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago

Please take the patch only if it's a positive warning. Thanks!

 hid-nintendo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +1 -1
@@ -152,13 +152,13 @@ struct joycon_subcmd_request {
 	u8 packet_num; /* incremented every send */
 	u8 rumble_data[8];
 	u8 subcmd_id;
-	u8 data[0]; /* length depends on the subcommand */
+	u8 data[]; /* length depends on the subcommand */

drivers/hid/hid-nintendo.c struct joycon_subcmd_request { · line 164

Quoted 10 lines
drivers/hid/hid-nintendo.c +1 -1
 } __packed;
 
 struct joycon_subcmd_reply {
 	u8 ack; /* MSB 1 for ACK, 0 for NACK */
 	u8 id; /* id of requested subcmd */
-	u8 data[0]; /* will be at most 35 bytes */
+	u8 data[]; /* will be at most 35 bytes */
 } __packed;
 
 struct joycon_input_report {

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services

Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw
Quoted 19 lines · Julia Lawall
Quoted 15 lines · Lee Jones
Quoted 13 lines · Julia Lawall

Zero-length and one-element arrays are deprecated, see Documentation/process/deprecated.rst Flexible-array members should be used instead.

Generated by: scripts/coccinelle/misc/flexible_array.cocci

Fixes f4dc6237a840 ("FROMLIST: HID: nintendo: add nintendo switch controller driver")
CC Daniel J. Ogorchock <[email protected]>

---

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

tree: https://git.linaro.org/people/lee.jones/linux.git aosp-android-mainline-tracking

Please refrain from sending patches based on this tree.

It's mainly used for hacking.

OK, I guess that the 0-day people will notice this and remove it from the list of checked trees.

Hi all,

Thanks for the information, we'll ignore the branch.

Best Regards,
Rong Chen

Quoted 45 lines

julia

Quoted 28 lines
Quoted 28 lines
head:   9b2a8deb96b1f9d4cc52497c4559f187db0408e1
commit: f4dc6237a840e52e0ecd3c46393af5b98029f650 [307/599] FROMLIST: HID: nintendo: add nintendo switch controller driver

:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago

Please take the patch only if it's a positive warning. Thanks!

  hid-nintendo.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +2 -2
@@ -152,13 +152,13 @@ struct joycon_subcmd_request {
  	u8 packet_num; /* incremented every send */
  	u8 rumble_data[8];
  	u8 subcmd_id;
-	u8 data[0]; /* length depends on the subcommand */
+	u8 data[]; /* length depends on the subcommand */
  } __packed;
 
  struct joycon_subcmd_reply {
  	u8 ack; /* MSB 1 for ACK, 0 for NACK */
  	u8 id; /* id of requested subcmd */
-	u8 data[0]; /* will be at most 35 bytes */
+	u8 data[]; /* will be at most 35 bytes */
  } __packed;
 
Quoted 8 lines

drivers/hid/hid-nintendo.c struct joycon_subcmd_request { · line 164

Quoted 1 line
drivers/hid/hid-nintendo.c +0 -0
  struct joycon_input_report {

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services

Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
kbuild-all mailing list -- kbuild-all(a)lists.01.org To unsubscribe send an email to kbuild-all-leave(a)lists.01.org