public inbox for chrome-platform@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: lightbar: Remove [0]
@ 2026-02-04  3:48 Gwendal Grignou
  2026-02-04  4:45 ` Tzung-Bi Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Gwendal Grignou @ 2026-02-04  3:48 UTC (permalink / raw)
  To: tzungbi; +Cc: chrome-platform, 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)

Fixes: d55493f6d2da ("platform/chrome: lightbar: Fix lightbar_program_ex alignment")
Signed-off-by: Gwendal Grignou <gwendal@google.com>
---
 include/linux/platform_data/cros_ec_commands.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
index bddc7568158e..8080a6fc6c8c 100644
--- a/include/linux/platform_data/cros_ec_commands.h
+++ b/include/linux/platform_data/cros_ec_commands.h
@@ -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 {
-- 
2.53.0.rc2.204.g2597b5adb4-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/chrome: lightbar: Remove [0]
  2026-02-04  3:48 [PATCH] platform/chrome: lightbar: Remove [0] Gwendal Grignou
@ 2026-02-04  4:45 ` Tzung-Bi Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Tzung-Bi Shih @ 2026-02-04  4:45 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: chrome-platform, Gwendal Grignou

On Tue, Feb 03, 2026 at 07:48:48PM -0800, Gwendal Grignou wrote:
> 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/aXhWlV6SyaAAum-Q@google.com/ 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!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-04  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04  3:48 [PATCH] platform/chrome: lightbar: Remove [0] Gwendal Grignou
2026-02-04  4:45 ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox