Gustavo A. R. Silva
bb4cf02d4c
netdevice: 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 >
Signed-off-by: David S. Miller <davem@davemloft.net >
2020-03-02 11:16:27 -08:00
..
2019-02-06 09:36:36 -08:00
2018-03-31 01:33:09 +08:00
2020-01-02 15:34:27 +01:00
2020-02-08 13:26:41 -08:00
2017-11-02 11:10:55 +01:00
2019-12-16 10:11:16 +01:00
2020-01-21 11:06:12 +05:30
2020-01-05 15:13:13 -08:00
2020-02-08 14:04:19 -08:00
2019-07-24 14:11:52 -07:00
2020-02-16 18:30:41 -08:00
2020-01-29 09:51:36 -08:00
2019-08-28 17:24:22 +02:00
2020-01-18 14:26:13 +00:00
2020-02-08 10:01:33 +00:00
2019-11-12 11:43:29 -05:00
2020-01-08 12:59:53 +01:00
2020-02-04 07:17:41 +00:00
2020-01-31 14:40:36 -08:00
2020-02-27 16:40:05 -08:00
2020-01-28 16:02:33 -08:00
2020-01-27 17:49:15 +01:00
2020-02-22 12:00:06 +01:00
2020-01-14 10:50:19 +05:30
2019-12-30 14:27:53 +01:00
2020-02-08 17:15:08 -08:00
2019-12-19 01:07:53 +01:00
2020-01-27 14:35:32 +01:00
2020-01-13 11:44:09 -08:00
2020-01-15 14:10:45 +00:00
2020-01-20 10:29:56 -08:00
2020-01-20 10:29:56 -08:00
2020-02-15 12:51:22 -08:00
2020-02-08 14:04:19 -08:00
2020-01-16 17:32:43 +05:30
2020-01-23 12:37:18 +00:00
2020-02-07 17:39:56 -08:00
2020-02-10 11:14:22 -08:00
2019-12-27 11:02:07 +01:00
2019-12-25 20:47:19 -07:00
2020-01-24 21:03:53 +01:00
2020-01-14 15:16:50 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-05-24 17:27:11 +02:00
2019-05-24 17:27:11 +02:00
2019-02-08 06:42:53 -07:00
2020-01-15 22:55:36 -05:00
2019-05-24 17:37:52 +02:00
2017-11-02 11:10:55 +01:00
2020-01-31 10:30:36 -08:00
2019-05-24 20:19:17 +02:00
2017-11-02 11:10:55 +01:00
2019-06-05 17:37:07 +02:00
2019-12-28 09:44:56 -07:00
2020-02-04 03:05:26 +00:00
2020-02-04 03:05:26 +00:00
2019-07-16 19:23:22 -07:00
2020-01-29 18:16:16 -08:00
2020-02-20 17:52:34 -05:00
2018-06-26 11:28:38 +02:00
2020-01-22 23:04:52 +01:00
2020-01-10 17:20:07 +01:00
2020-02-28 01:21:02 +01:00
2020-02-27 18:50:19 -08:00
2019-04-30 16:11:59 -06:00
2020-01-22 23:04:52 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-10-02 22:20:50 -04:00
2019-12-04 19:44:12 -08:00
2020-01-04 20:23:39 -07:00
2017-11-02 11:10:55 +01:00
2020-01-31 13:14:26 -08:00
2020-01-07 11:31:47 +01:00
2020-01-27 10:24:32 +01:00
2018-10-25 11:14:36 -07:00
2018-08-17 16:20:32 -07:00
2019-09-24 15:54:10 -07:00
2020-02-21 11:22:15 -08:00
2020-01-21 13:28:24 +01:00
2017-11-02 11:10:55 +01:00
2020-01-27 19:59:55 +01:00
2020-01-27 10:24:32 +01:00
2020-02-03 16:56:48 +01:00
2020-02-08 14:04:19 -08:00
2020-01-23 00:35:50 +01:00
2020-02-04 03:05:27 +00:00
2020-01-09 11:30:53 +08:00
2017-11-02 11:10:55 +01:00
2018-10-08 22:53:10 +11:00
2020-01-16 09:52:27 -08:00
2019-05-24 17:27:11 +02:00
2020-02-28 12:08:37 -08:00
2019-12-16 10:11:10 +01:00
2017-05-05 15:54:45 +08:00
2019-12-30 09:59:06 +09:00
2020-02-26 20:07:25 -08:00
2019-11-26 11:52:57 +01:00
2020-01-27 10:55:50 -08:00
2018-03-16 19:58:27 +01:00
2017-11-02 11:10:55 +01:00
2019-06-19 17:09:55 +02:00
2020-01-20 08:14:29 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-02-28 03:28:53 -05:00
2019-08-07 13:52:43 +01:00
2020-01-27 11:09:31 +01:00
2019-12-27 16:40:02 -08:00
2020-02-29 21:48:54 -08:00
2020-02-03 17:27:38 -07:00
2020-01-29 15:45:47 -07:00
2017-11-02 11:10:55 +01:00
2019-11-12 08:18:04 -08:00
2019-06-05 17:36:37 +02:00
2020-01-13 14:15:27 +09:00
2020-01-17 16:48:07 -08:00
2020-01-03 09:42:52 +01:00
2020-01-03 14:27:40 +01:00
2019-05-30 11:26:32 -07:00
2020-01-18 09:19:18 -05:00
2017-11-02 11:10:55 +01:00
2020-01-13 21:48:42 +01:00
2020-02-24 16:20:09 -08:00
2019-07-26 14:51:57 +10:00
2017-11-02 11:10:55 +01:00
2018-05-14 16:44:41 +02:00
2020-02-07 14:48:39 -05:00
2020-02-07 14:48:38 -05:00
2020-02-08 13:26:41 -08:00
2019-05-30 11:26:32 -07:00
2020-01-22 14:50:03 -08:00
2020-01-14 13:27:32 -08:00
2019-11-20 09:40:10 +01:00
2019-11-27 11:06:20 -08:00
2020-01-28 10:07:09 -08:00
2017-11-02 11:10:55 +01:00
2019-12-01 12:59:06 -08:00
2018-08-02 10:24:51 +02:00
2019-06-05 17:37:06 +02:00
2020-02-12 14:18:33 +01:00
2019-06-05 17:36:38 +02:00
2017-11-02 11:10:55 +01:00
2020-01-15 16:21:28 +10:00
2019-06-22 21:21:04 +02:00
2020-01-14 12:20:55 +01:00
2020-01-27 20:00:01 +01:00
2017-11-02 11:10:55 +01:00
2020-01-23 13:15:09 -08:00
2020-01-26 22:10:17 -05:00
2018-03-08 12:30:37 +01:00
2019-11-05 14:03:11 -08:00
2020-02-25 11:01:39 -08:00
2020-01-30 07:39:10 -08:00
2020-02-14 09:59:24 +01:00
2020-01-08 12:52:33 -08:00
2019-01-22 10:23:17 +01:00
2020-01-22 15:22:51 -05:00
2020-02-27 18:50:19 -08:00
2020-01-07 14:05:58 +01:00
2020-02-10 10:41:20 +01:00
2019-08-13 23:02:44 +03:00
2017-11-02 11:10:55 +01:00
2020-01-31 10:30:41 -08:00
2020-01-10 15:52:25 +00:00
2020-01-06 09:45:59 +01:00
2020-01-24 15:39:39 +01:00
2019-05-30 11:26:32 -07:00
2020-02-01 09:31:47 +01:00
2020-02-21 11:29:15 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-06-05 17:36:37 +02:00
2020-01-25 03:01:56 -05:00
2019-12-18 18:07:33 +01:00
2019-12-31 13:15:38 +01:00
2019-03-28 10:58:28 +01:00
2020-01-31 17:33:54 +00:00
2017-11-02 11:10:55 +01:00
2019-11-21 07:33:24 +01:00
2017-11-02 11:10:55 +01:00
2020-02-20 21:17:24 +01:00
2019-12-11 09:12:38 +01:00
2017-11-02 11:10:55 +01:00
2020-02-21 11:22:15 -08:00
2020-02-17 12:52:38 +01:00
2020-01-30 18:45:55 +01:00
2019-08-05 21:52:53 +02:00
2017-11-02 11:10:55 +01:00
2019-12-21 20:09:54 +01:00
2020-01-06 00:20:18 +01:00
2020-02-06 06:11:50 +00:00
2019-05-24 17:39:02 +02:00
2019-08-06 08:20:10 -06:00
2019-03-07 18:31:59 -08:00
2020-02-16 19:39:44 -08:00
2018-03-26 15:56:42 +02:00
2019-04-18 16:18:27 -04:00
2020-01-10 14:00:57 -08:00
2020-01-28 08:46:13 -08:00
2018-04-12 09:41:19 -07:00
2017-11-02 11:10:55 +01:00
2019-05-24 17:37:53 +02:00
2019-06-19 17:09:55 +02:00
2017-11-02 11:10:55 +01:00
2019-06-05 17:37:17 +02:00
2019-09-05 12:32:05 +02:00
2020-01-31 10:30:38 -08:00
2020-02-04 03:05:23 +00:00
2020-01-31 10:30:39 -08:00
2019-06-19 17:09:55 +02:00
2019-10-17 16:31:52 -07:00
2019-05-21 11:28:45 +02:00
2019-12-25 19:51:33 -08:00
2020-01-05 23:22:32 -08:00
2019-12-06 10:28:09 -08:00
2020-02-04 07:21:04 +00:00
2020-02-04 07:24:48 +00:00
2018-03-18 07:38:47 -07:00
2018-04-05 21:36:27 -07:00
2020-01-14 11:54:47 -04:00
2020-02-04 03:05:23 +00:00
2019-12-20 21:47:04 -08:00
2020-02-01 10:01:52 -08:00
2019-04-04 21:04:13 -04:00
2018-03-24 11:25:35 -05:00
2019-10-23 17:23:44 +02:00
2019-08-08 09:09:25 +02:00
2020-01-29 11:20:24 -08:00
2019-11-14 19:06:47 -08:00
2020-01-27 11:00:21 +01:00
2020-03-02 11:16:27 -08:00
2020-02-27 18:50:19 -08:00
2020-01-15 10:54:33 -05:00
2020-02-12 13:55:25 -05:00
2020-01-24 16:51:13 -05:00
2017-11-02 11:10:55 +01:00
2018-05-05 00:51:44 +02:00
2017-11-02 11:10:55 +01:00
2020-01-14 12:20:48 +01:00
2020-01-09 10:48:54 +01:00
2019-02-08 15:02:49 -08:00
2020-02-05 14:52:03 -08:00
2018-09-08 11:19:28 +02:00
2019-12-26 15:17:26 -08:00
2019-11-04 11:21:25 -08:00
2020-01-02 16:50:04 +01:00
2019-05-30 11:26:35 -07:00
2019-06-05 17:30:29 +02:00
2019-12-11 16:37:02 +08:00
2019-10-14 15:04:00 -07:00
2019-11-06 08:28:58 -08:00
2020-01-31 10:30:39 -08:00
2019-05-30 11:26:39 -07:00
2020-01-06 08:58:23 -08:00
2020-02-04 03:05:25 +00:00
2020-01-16 17:09:18 +01:00
2020-01-15 16:30:28 +00:00
2020-01-29 17:00:02 -06:00
2020-01-31 11:15:59 -08:00
2020-01-20 17:04:02 -07:00
2019-10-09 12:46:10 +02:00
2019-07-04 08:05:52 -07:00
2020-02-09 12:04:09 -08:00
2019-09-05 11:54:14 +02:00
2020-02-24 15:31:23 -08:00
2020-02-27 12:02:14 -08:00
2020-02-12 11:54:08 -08:00
2018-05-09 11:51:46 +10:00
2020-01-02 16:52:40 +01:00
2020-01-23 13:15:09 -08:00
2018-10-08 22:53:10 +11:00
2019-12-30 20:19:27 -08:00
2019-12-19 01:36:32 +01:00
2020-02-20 21:17:24 +01:00
2020-02-04 03:05:26 +00:00
2020-01-29 11:20:24 -08:00
2019-12-03 11:46:20 +01:00
2020-01-02 16:49:59 +01:00
2020-01-04 13:49:51 +08:00
2020-02-04 03:05:25 +00:00
2019-12-30 20:31:40 -08:00
2020-01-13 18:16:43 -08:00
2020-01-07 22:14:38 -08:00
2020-02-07 14:48:37 -05:00
2020-01-25 12:18:50 -05:00
2017-11-02 11:10:55 +01:00
2019-07-16 19:23:22 -07:00
2020-01-24 10:24:31 -08:00
2020-02-17 10:55:14 +01:00
2020-01-10 14:00:58 -08:00
2020-01-24 10:37:27 -08:00
2020-01-24 10:24:31 -08:00
2020-01-24 10:24:31 -08:00
2020-01-09 21:23:36 +00:00
2019-05-30 11:29:21 -07:00
2020-01-20 16:19:10 +01:00
2019-12-05 11:43:31 -08:00
2019-10-29 10:47:14 +00:00
2019-05-29 13:27:08 -07:00
2020-01-13 13:19:38 -05:00
2019-06-05 17:37:17 +02:00
2018-06-03 17:37:11 -07:00
2019-10-09 12:46:10 +02:00
2019-06-19 17:09:55 +02:00
2020-01-29 19:38:34 -08:00
2019-12-24 11:35:48 +00:00
2017-11-02 11:10:55 +01:00
2019-11-04 07:11:31 -07:00
2020-02-04 03:05:26 +00:00
2019-10-09 12:46:10 +02:00
2020-01-15 13:39:14 +01:00
2016-07-13 09:24:51 +02:00
2018-01-09 10:37:00 -05:00
2020-02-07 14:48:37 -05:00
2019-09-24 15:54:11 -07:00
2019-05-30 11:26:32 -07:00
2020-02-28 12:12:53 -08:00
2020-02-21 22:29:45 +01:00
2020-02-04 03:05:24 +00:00
2020-01-24 20:40:09 +01:00
2019-10-09 12:46:10 +02:00
2019-05-28 09:03:35 -07:00
2019-05-30 11:26:37 -07:00
2019-07-25 15:43:26 +02:00
2019-02-07 16:38:35 +01:00
2012-02-24 10:05:59 +01:00
2020-01-13 18:31:48 -08:00
2020-01-17 10:19:21 +01:00
2020-02-04 03:05:26 +00:00
2020-02-11 10:11:02 +01:00
2020-01-31 10:30:40 -08:00
2019-07-16 19:23:21 -07:00
2020-02-05 18:53:05 +01:00
2020-01-15 11:00:39 -06:00
2020-01-06 13:33:14 -08:00
2012-10-13 10:46:48 +01:00
2019-10-10 14:35:32 +02:00
2020-01-29 19:38:34 -08:00
2020-02-26 20:07:25 -08:00
2017-11-02 11:10:55 +01:00
2020-01-29 17:45:20 +01:00
2018-04-16 18:53:13 -04:00
2020-01-31 10:30:40 -08:00
2019-12-09 12:32:59 -08:00
2020-02-21 11:22:15 -08:00
2020-01-14 12:20:59 +01:00
2020-01-14 12:20:57 +01:00
2019-05-30 11:26:37 -07:00
2020-02-21 11:22:15 -08:00
2019-06-25 08:54:51 +02:00
2019-02-07 00:13:28 +01:00
2020-01-15 13:39:59 -08:00
2019-12-17 11:46:43 +02:00
2020-02-11 16:39:18 -08:00
2019-11-14 13:15:12 -05:00
2019-12-10 22:29:58 -05:00
2019-07-16 19:23:24 -07:00
2020-01-15 22:55:37 -05:00
2017-11-02 11:10:55 +01:00
2020-02-10 12:26:44 -08:00
2020-02-21 11:22:15 -08:00
2019-11-07 20:03:08 -08:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:26:32 -07:00
2020-01-31 10:30:39 -08:00
2020-01-14 12:20:48 +01:00
2005-04-16 15:20:36 -07:00
2019-08-05 18:40:18 -04:00
2019-08-14 01:10:42 +09:00
2015-12-04 10:38:59 -02:00
2017-11-02 11:10:55 +01:00
2019-03-06 11:19:57 -05:00
2012-10-13 10:46:48 +01:00
2019-04-08 17:05:52 -04:00
2019-11-14 18:12:18 -08:00
2019-05-12 13:11:36 -04:00
2019-05-30 11:26:35 -07:00
2017-11-02 11:10:55 +01:00
2019-10-29 10:01:16 +01:00
2020-01-17 22:33:37 -05:00
2020-01-31 10:30:40 -08:00
2017-08-15 09:02:08 -07:00