Gustavo A. R. Silva 7c36948329 Bluetooth: hci_intel: 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
inadvertenly 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: Marcel Holtmann <marcel@holtmann.org>
2020-02-13 08:28:38 +01:00
..
2019-10-23 06:26:33 -04:00
2020-01-17 05:54:18 -08:00
2020-01-16 19:42:08 -08:00
2019-12-01 18:43:25 -08:00
2019-10-31 11:24:52 +01:00
2020-01-21 10:22:51 +01:00
2019-11-30 14:35:43 -08:00
2019-12-01 18:42:02 -08:00
2019-11-03 19:54:53 +01:00
2020-01-04 10:41:08 -08:00
2019-12-06 08:28:51 -08:00
2019-12-03 13:58:22 -08:00
2019-12-03 14:37:12 -08:00
2020-01-27 14:35:32 +01:00
2019-12-01 18:43:25 -08:00
2019-12-05 11:43:31 -08:00
2019-11-25 19:40:40 -08:00
2020-01-17 09:07:26 +01:00
2019-12-05 11:28:14 -08:00
2020-01-06 12:04:31 -08:00
2019-12-01 18:39:24 -08:00
2020-01-26 15:20:32 +01:00
2020-01-18 12:12:36 -08:00
2020-01-16 19:42:08 -08:00
2020-01-06 12:34:44 -08:00
2019-12-27 17:28:41 -08:00
2020-01-24 12:05:08 -08:00
2020-01-17 19:40:06 +01:00
2019-12-07 14:51:04 -08:00
2019-12-03 13:58:22 -08:00
2019-11-14 13:06:33 +08:00
2019-12-21 06:24:56 -08:00