History

platform/chrome: Replace fake flexible arrays with flexible-array member

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].

Gustavo A. R. Silva committed 3 years ago

Commit 32d2a151 parent 7e364e51 file · +1 −1Browse files

Showing the changes to include/linux/platform_data (1 of 1 file). Show all

Unified · Split

include/linux/platform_data/cros_ec_commands.h+1−1
@@ -2701,7 +2701,7 @@ struct ec_response_motion_sense { · 2700 unmodified lines
27012701 * Sensor data is truncated if response_max is too small
27022702 * for holding all the data.
27032703 */
2704− struct ec_response_motion_sensor_data sensor[0];
2704+ DECLARE_FLEX_ARRAY(struct ec_response_motion_sensor_data, sensor);
27052705 } dump;
27062706
27072707 /* Used for MOTIONSENSE_CMD_INFO. */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t