Gustavo A. R. Silva
1223f3db71
platform_data: wilco-ec.h: Replace zero-length array with flexible-array member
...
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.
Also, notice that, dynamic memory allocations won't be affected by
this change:
"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]
This issue was found with the help of Coccinelle.
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293
("cxgb3/l2t: Fix undefined behaviour")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com >
2020-04-18 15:44:55 -05:00
..
2019-03-22 16:48:47 +01:00
2019-05-30 11:26:28 -07:00
2019-07-09 09:47:22 -07:00
2019-06-19 17:09:55 +02:00
2020-01-10 11:57:22 +02:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:29:19 -07:00
2019-12-15 11:42:16 +00:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:25:18 -07:00
2019-05-30 11:25:18 -07:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:25:18 -07:00
2019-05-30 11:25:18 -07:00
2019-05-30 11:25:18 -07:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:37:07 +02:00
2019-05-30 11:29:22 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:35 -07:00
2019-05-30 11:29:22 -07:00
2019-05-24 17:36:47 +02:00
2019-05-21 11:28:46 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:08 +02:00
2020-02-05 14:00:05 +01:00
2019-12-16 10:32:27 +00:00
2019-06-05 17:37:07 +02:00
2019-06-19 17:09:55 +02:00
2019-09-12 16:20:54 +02:00
2019-10-21 13:52:00 +01:00
2020-02-11 10:32:54 +01:00
2020-03-28 22:04:32 +01:00
2020-02-10 10:14:19 -08:00
2019-05-30 11:29:22 -07:00
2019-06-05 17:30:29 +02:00
2018-11-28 12:41:31 +00:00
2019-02-18 11:58:08 +05:30
2019-05-30 11:26:32 -07:00
2019-05-30 11:29:22 -07:00
2019-01-07 17:57:13 +05:30
2018-10-02 20:11:00 +05:30
2019-06-19 17:09:55 +02:00
2019-10-14 13:33:44 +05:30
2019-07-17 09:55:43 -07:00
2019-08-14 15:36:22 +02:00
2018-09-11 12:06:39 +05:30
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:29:22 -07:00
2020-03-16 12:40:51 +01:00
2019-04-17 10:37:23 -07:00
2019-01-17 11:31:24 -08:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:37 -07:00
2019-06-19 17:09:55 +02:00
2020-01-12 12:59:53 -08:00
2019-04-28 23:08:15 -07:00
2019-05-30 11:26:35 -07:00
2019-11-11 11:34:01 +00:00
2019-06-19 17:09:55 +02:00
2018-11-26 16:45:10 +05:30
2019-06-05 17:36:37 +02:00
2019-09-12 10:07:44 +01:00
2019-07-09 09:07:00 -07:00
2019-06-05 17:37:15 +02:00
2019-11-15 09:59:19 +01:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:36:37 +02:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:37:16 +02:00
2019-07-15 21:10:39 -07:00
2019-05-30 11:26:32 -07:00
2019-02-14 17:58:23 +01:00
2019-11-11 21:38:09 +01:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:29:19 -07:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:29:53 -07:00
2019-10-23 09:27:18 +03:00
2019-06-05 17:36:37 +02:00
2019-08-09 17:37:09 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-04-28 23:08:35 -07:00
2019-05-30 11:29:22 -07:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:35 -07:00
2019-05-30 11:29:22 -07:00
2019-05-30 11:29:22 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:37:07 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:37:12 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2018-12-08 21:33:30 -08:00
2019-06-19 17:09:55 +02:00
2020-02-05 14:00:05 +01:00
2020-01-13 21:02:46 +02:00
2020-03-24 14:35:41 +01:00
2019-06-19 17:09:55 +02:00
2018-12-17 08:26:24 +01:00
2018-12-17 08:26:24 +01:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-24 17:36:45 +02:00
2019-05-21 11:28:39 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-03 23:55:47 -04:00
2019-12-30 20:11:29 +01:00
2019-05-30 11:29:22 -07:00
2019-05-30 11:26:35 -07:00
2019-06-05 17:37:07 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-08-05 11:08:55 +02:00
2020-02-27 09:27:27 -08:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-07-31 14:13:13 -06:00
2019-06-05 17:37:18 +02:00
2019-05-21 11:28:39 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-09-04 14:34:31 +02:00
2018-09-14 13:54:02 +03:00
2019-05-30 11:26:37 -07:00
2019-06-05 17:36:37 +02:00
2020-03-02 16:32:14 +01:00
2019-06-19 17:09:07 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-05-24 17:36:45 +02:00
2019-05-02 10:37:59 +09:00
2019-11-18 17:47:00 +00:00
2020-02-06 15:53:40 +00:00
2019-05-30 11:29:19 -07:00
2019-05-21 11:28:45 +02:00
2019-10-15 21:11:05 +01:00
2019-06-19 17:09:55 +02:00
2019-10-09 08:55:38 -07:00
2020-03-04 07:54:57 -08:00
2019-04-23 16:02:13 +02:00
2019-06-19 17:09:55 +02:00
2019-12-30 20:40:19 +01:00
2019-02-12 13:48:59 +05:30
2019-05-30 11:29:22 -07:00
2019-05-30 11:26:37 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:29:22 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2020-01-12 12:59:52 -08:00
2020-04-18 15:44:55 -05:00
2019-05-30 11:25:18 -07:00
2019-05-30 11:26:41 -07:00
2019-05-23 09:33:57 -07:00
2019-05-09 16:39:27 -07:00
2019-06-05 17:36:37 +02:00