Skip to contentSkip to conversation

platform/chrome: lightbar: Remove [0]

PATCH In review Gwendal Grignou 2 participants 2 messages Feb 4 ChromeOS EC subdrivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/chrome: lightbar: Remove [0]

Variable arrays should be defined as [], not [0], otherwise the kernel complains:

memcpy : detected field-spanning write (size 9) of single field "param->set_program_ex.data" at drivers/platform/chrome/cros_ec_lightbar.c:603 (size 0)

Fixes d55493f6d2da ("platform/chrome: lightbar: Fix lightbar_program_ex alignment")
---
 include/linux/platform_data/cros_ec_commands.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/platform_data/cros_ec_commands.h +1 -1
index bddc7568158e..8080a6fc6c8c 100644
@@ -2028,7 +2028,7 @@ struct lightbar_program {
 struct lightbar_program_ex {
 	uint8_t size;
 	uint16_t offset;
-	uint8_t data[0];
+	uint8_t data[];
 } __ec_todo_packed;
 
 struct ec_params_lightbar {
Signature · 1 line
2.53.0.rc2.204.g2597b5adb4-goog
#1 lore raw
Quoted 4 lines · Gwendal Grignou

Variable arrays should be defined as [], not [0], otherwise the kernel complains:

memcpy : detected field-spanning write (size 9) of single field "param->set_program_ex.data" at drivers/platform/chrome/cros_ec_lightbar.c:603 (size 0)

Oops, https://lore.kernel.org/all/[email protected]/ raised the concern but we haven't addressed it.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next

[1/1] platform/chrome: lightbar: Remove [0]

      commit: 520e345dfdab89aed4a0ad98d5ec35086661a11a

Thanks!