Gustavo A. R. Silva
7235d9e48f
mfd: pm8xxx: 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 76497732932f ("cxgb3/l2t: Fix undefined behaviour")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30 07:34:57 +01:00
..
2019-06-19 17:09:55 +02:00
2019-08-12 08:51:45 +01:00
2019-08-12 08:51:50 +01:00
2019-06-19 17:09:55 +02:00
2019-08-12 07:27:40 +01:00
2019-08-12 08:51:54 +01:00
2019-08-12 07:27:40 +01:00
2020-01-24 07:33:57 +00:00
2019-10-18 19:37:45 +01: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-05-30 11:26:32 -07:00
2019-05-30 11:25:18 -07:00
2019-05-30 11:29:52 -07:00
2019-07-30 13:07:41 +02:00
2019-11-11 08:45:02 +00: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-06-05 17:37:04 +02:00
2019-05-30 11:26:35 -07:00
2019-08-14 09:07:20 +01:00
2019-02-07 10:44:09 +00:00
2019-06-19 17:09:07 +02:00
2020-01-07 10:08:58 +00: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-24 07:33:57 +00:00
2019-08-12 08:51:58 +01:00
2019-01-09 16:55:09 +01:00
2019-01-03 08:32:42 +00:00
2020-03-30 07:34:56 +01:00
2020-01-24 07:33:58 +00:00
2019-06-19 17:09:55 +02:00
2019-07-02 12:11:31 +01:00
2019-07-02 12:11:31 +01:00
2019-07-02 12:11:31 +01:00
2019-07-02 12:11:31 +01:00
2019-11-11 08:45:03 +00:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2020-01-24 07:33:58 +00:00
2019-05-14 08:13:26 +01:00
2019-05-14 08:13:26 +01:00
2019-05-14 08:13:26 +01:00
2019-08-12 08:52:03 +01:00
2019-07-25 14:21:43 +01:00
2020-01-24 07:33:58 +00:00
2019-05-30 11:29:22 -07:00
2020-01-24 07:33:57 +00:00
2019-05-30 11:26:32 -07:00
2019-06-05 17:37:11 +02:00
2019-09-02 11:05:37 +01:00
2019-08-12 11:29:47 +01:00
2019-07-15 20:18:40 -07:00
2019-06-19 17:09:55 +02:00
2019-09-02 11:09:03 +01:00
2019-06-05 17:37:17 +02:00
2018-10-23 08:58:34 +01:00
2019-06-05 17:36:37 +02:00
2019-08-12 11:29:47 +01:00
2018-10-23 08:58:34 +01:00
2019-05-14 08:13:25 +01:00
2020-01-03 11:47:00 +01:00
2018-10-23 08:58:34 +01:00
2019-12-01 16:16:31 -08:00
2019-09-02 11:09:03 +01:00
2019-09-02 11:09:03 +01:00
2020-01-24 07:33:57 +00:00
2019-11-11 08:40:21 +00:00
2019-06-19 17:09:55 +02:00
2020-01-09 15:30:59 -08:00
2019-11-11 08:45:01 +00:00
2020-03-27 08:25:37 +00:00
2019-05-30 11:26:32 -07:00
2020-03-30 07:34:57 +01:00
2019-06-05 17:36:38 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-02-07 10:44:00 +00:00
2016-10-04 15:48:04 +01: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-15 20:18:40 -07:00
2019-06-05 17:36:38 +02:00
2019-06-05 17:36:38 +02:00
2020-01-24 07:33:58 +00:00
2019-07-02 12:11:31 +01:00
2019-07-02 12:11:31 +01:00
2019-07-15 20:18:40 -07:00
2020-03-27 08:25:37 +00:00
2019-08-12 08:53:58 +01:00
2019-06-19 17:09:55 +02:00
2019-08-12 08:54:10 +01:00
2018-10-23 08:58:34 +01:00
2019-08-12 08:53:58 +01:00
2018-10-23 08:58:34 +01:00
2019-08-12 08:53:58 +01:00
2019-08-12 08:53:58 +01:00
2019-11-11 08:45:02 +00:00
2019-05-08 12:06:21 +01:00
2018-10-23 08:58:34 +01:00
2019-08-12 08:53:58 +01:00
2019-08-12 08:54:05 +01: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:29:19 -07:00
2019-05-30 11:29:19 -07:00
2019-07-15 20:18:40 -07:00
2019-05-30 11:26:32 -07:00
2019-11-11 11:23:57 +00:00
2019-06-19 17:09:55 +02:00
2019-11-11 08:45:02 +00:00
2019-08-12 12:29:30 +01:00
2019-05-30 11:26:37 -07:00
2019-08-12 11:28:55 +01:00
2020-03-30 07:34:57 +01:00
2019-08-12 08:54:16 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-08-12 11:29:47 +01:00
2020-03-30 07:34:57 +01:00
2019-11-11 08:45:02 +00:00
2019-01-03 08:32:42 +00:00
2019-05-30 11:29:52 -07:00
2019-05-30 11:29:52 -07:00
2019-05-24 17:36:45 +02:00
2017-07-18 08:27:18 +01:00
2019-11-11 08:45:01 +00:00
2020-03-27 09:42:44 +00:00
2020-01-24 07:22:31 +00:00
2020-01-24 07:21:48 +00:00
2020-01-24 07:22:43 +00:00
2019-06-05 17:37:18 +02:00
2019-05-14 08:13:25 +01:00
2019-05-14 08:13:25 +01:00
2019-06-05 17:36:37 +02:00
2019-06-05 17:36:37 +02:00
2019-06-05 17:36:37 +02:00
2019-06-19 17:09:07 +02:00
2020-01-24 07:33:56 +00:00
2018-05-16 09:21:48 +01:00
2019-06-05 17:36:37 +02:00
2019-06-05 17:36:37 +02:00
2019-06-05 17:37:06 +02:00
2018-01-08 11:03:35 +00:00
2018-05-16 09:10:38 +01:00
2019-06-24 15:19:31 +01:00
2019-06-19 17:09:10 +02:00
2019-06-19 17:09:10 +02:00
2019-06-19 17:09:10 +02:00
2019-06-19 17:09:10 +02:00
2019-01-16 13:59:34 +00:00
2019-05-30 11:29:22 -07:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:29:22 -07:00
2020-01-24 07:33:59 +00:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:10 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-11-11 11:26:26 +00:00
2019-07-09 08:59:39 -07:00
2019-08-12 08:46:29 +01:00
2019-05-30 11:29:19 -07:00
2019-06-19 17:09:55 +02:00
2019-11-20 17:10:36 +00:00
2016-06-29 10:14:35 +01:00
2019-06-19 17:09:55 +02:00
2019-05-24 17:36:45 +02:00
2019-05-30 11:29:52 -07:00
2017-10-13 10:42:58 +01:00
2019-02-01 08:21:13 +00:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2016-11-29 08:21:21 +00:00
2017-02-13 09:29:43 +00:00
2019-05-14 08:13:27 +01:00
2019-02-07 10:44:14 +00:00
2019-08-12 08:40:45 +01:00
2020-01-24 07:33:58 +00:00
2019-06-05 17:37:07 +02:00
2019-05-30 11:26:35 -07:00
2017-09-04 14:41:02 +01:00
2019-05-30 11:26:35 -07:00
2019-06-05 17:37:07 +02:00
2019-08-12 08:53:58 +01:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:29:19 -07:00
2019-05-30 11:29:19 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:41 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:35 -07:00
2020-01-29 11:18:40 +00: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-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07: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-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-06-19 17:09:55 +02:00
2019-11-11 08:45:02 +00:00