Files
kernel_arpi/include/uapi/linux
Gustavo A. R. Silva 1a91a36aba mmc: 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>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20200226223125.GA20630@embeddedor
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2020-03-24 14:39:45 +01:00
..
2019-12-18 18:07:31 +01:00
2019-03-07 18:32:01 -08:00
2019-10-09 22:31:14 -04:00
2019-09-25 17:51:39 -07:00
2019-08-02 14:44:02 +10:00
2019-06-14 15:00:51 +05:30
2020-01-18 09:19:18 -05:00
2019-03-27 13:30:07 -07:00
2019-08-12 19:33:50 -07:00
2019-12-11 15:31:52 +01:00
2019-09-08 15:37:04 +02:00
2020-01-31 12:50:04 +01:00
2020-02-07 14:39:38 +09:00
2019-08-19 13:04:45 -07:00
2019-05-28 21:37:30 -07:00
2020-01-18 09:19:18 -05:00
2019-10-02 20:32:27 -06:00
2019-07-30 20:34:34 +02:00
2019-12-18 10:37:18 +01:00
2020-01-14 12:20:48 +01:00
2020-01-26 15:28:47 +01:00
2019-11-13 12:15:34 -08:00
2019-12-18 18:07:31 +01:00
2020-01-26 15:28:47 +01:00
2020-01-04 13:49:51 +08:00
2019-12-09 09:59:07 +01:00
2019-09-18 20:17:50 +02:00
2019-08-01 21:49:46 +02:00