chrome-platform.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member
@ 2023-03-06 20:59 Gustavo A. R. Silva
  2023-03-07  4:35 ` patchwork-bot+chrome-platform
  2023-03-08  3:10 ` patchwork-bot+chrome-platform
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2023-03-06 20:59 UTC (permalink / raw)
  To: Benson Leung, Guenter Roeck
  Cc: chrome-platform, linux-kernel, Gustavo A. R. Silva, linux-hardening

Zero-length arrays as fake flexible arrays are deprecated and we are
moving towards adopting C99 flexible-array members instead.

Use the DECLARE_FLEX_ARRAY() helper macro to transform zero-length
arrays in unions with flexible-array members.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
drivers/iio/accel/cros_ec_accel_legacy.c:66:46: warning: array subscript <unknown> is outside array bounds of ‘struct ec_response_motion_sensor_data[0]’ [-Warray-bounds=]

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/193
Link: https://github.com/KSPP/linux/issues/262
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 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 7e9c76aedd2d..ab721cf13a98 100644
--- a/include/linux/platform_data/cros_ec_commands.h
+++ b/include/linux/platform_data/cros_ec_commands.h
@@ -2701,7 +2701,7 @@ struct ec_response_motion_sense {
 			 * Sensor data is truncated if response_max is too small
 			 * for holding all the data.
 			 */
-			struct ec_response_motion_sensor_data sensor[0];
+			DECLARE_FLEX_ARRAY(struct ec_response_motion_sensor_data, sensor);
 		} dump;
 
 		/* Used for MOTIONSENSE_CMD_INFO. */
-- 
2.34.1


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

* Re: [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member
  2023-03-06 20:59 [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member Gustavo A. R. Silva
@ 2023-03-07  4:35 ` patchwork-bot+chrome-platform
  2023-03-08  3:10 ` patchwork-bot+chrome-platform
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-03-07  4:35 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: bleung, groeck, chrome-platform, linux-kernel, linux-hardening

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Mon, 6 Mar 2023 14:59:04 -0600 you wrote:
> Zero-length arrays as fake flexible arrays are deprecated and we are
> moving towards adopting C99 flexible-array members instead.
> 
> Use the DECLARE_FLEX_ARRAY() helper macro to transform zero-length
> arrays in unions with flexible-array members.
> 
> Address the following warning found with GCC-13 and
> -fstrict-flex-arrays=3 enabled:
> drivers/iio/accel/cros_ec_accel_legacy.c:66:46: warning: array subscript <unknown> is outside array bounds of ‘struct ec_response_motion_sensor_data[0]’ [-Warray-bounds=]
> 
> [...]

Here is the summary with links:
  - [next] platform/chrome: Replace fake flexible arrays with flexible-array member
    https://git.kernel.org/chrome-platform/c/22181069e867

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member
  2023-03-06 20:59 [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member Gustavo A. R. Silva
  2023-03-07  4:35 ` patchwork-bot+chrome-platform
@ 2023-03-08  3:10 ` patchwork-bot+chrome-platform
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-03-08  3:10 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: bleung, groeck, chrome-platform, linux-kernel, linux-hardening

Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Mon, 6 Mar 2023 14:59:04 -0600 you wrote:
> Zero-length arrays as fake flexible arrays are deprecated and we are
> moving towards adopting C99 flexible-array members instead.
> 
> Use the DECLARE_FLEX_ARRAY() helper macro to transform zero-length
> arrays in unions with flexible-array members.
> 
> Address the following warning found with GCC-13 and
> -fstrict-flex-arrays=3 enabled:
> drivers/iio/accel/cros_ec_accel_legacy.c:66:46: warning: array subscript <unknown> is outside array bounds of ‘struct ec_response_motion_sensor_data[0]’ [-Warray-bounds=]
> 
> [...]

Here is the summary with links:
  - [next] platform/chrome: Replace fake flexible arrays with flexible-array member
    https://git.kernel.org/chrome-platform/c/22181069e867

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-03-08  3:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 20:59 [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member Gustavo A. R. Silva
2023-03-07  4:35 ` patchwork-bot+chrome-platform
2023-03-08  3:10 ` patchwork-bot+chrome-platform

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).