linux-stable/drivers/fpga
Gustavo A. R. Silva 5a53881580 fpga: dfl.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>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
2020-04-29 20:37:12 -07:00
..
altera-cvp.c fpga: altera-cvp: Add Stratix10 (V2) Support 2019-08-24 11:38:29 -07:00
altera-fpga2sdram.c
altera-freeze-bridge.c
altera-hps2fpga.c
altera-pr-ip-core-plat.c fpga: altera-pr-ip: Make alt_pr_unregister function void 2019-07-24 14:11:52 -07:00
altera-pr-ip-core.c fpga: altera-pr-ip: Make alt_pr_unregister function void 2019-07-24 14:11:52 -07:00
altera-ps-spi.c fpga: altera-ps-spi: Fix getting of optional confd gpio 2019-08-18 17:40:02 -07:00
dfl-afu-dma-region.c mm: add account_locked_vm utility function 2019-07-16 19:23:25 -07:00
dfl-afu-error.c fpga: dfl: afu: add error reporting support. 2019-09-03 19:35:41 -07:00
dfl-afu-main.c fpga: dfl: support multiple opens on feature device node. 2020-04-29 20:37:07 -07:00
dfl-afu-region.c
dfl-afu.h fpga: dfl: afu: add error reporting support. 2019-09-03 19:35:41 -07:00
dfl-fme-br.c
dfl-fme-error.c fpga: dfl: fme: add global error reporting support 2019-09-03 19:35:41 -07:00
dfl-fme-main.c fpga: dfl: support multiple opens on feature device node. 2020-04-29 20:37:07 -07:00
dfl-fme-mgr.c fpga: dfl-fme-mgr: fix FME_PR_INTFC_ID register address. 2019-07-03 19:58:58 +02:00
dfl-fme-pr.c fpga: dfl: add id_table for dfl private feature driver 2019-08-05 18:01:24 +02:00
dfl-fme-pr.h
dfl-fme-region.c fpga: dfl-fme-region: Use platform_get_drvdata() 2018-11-26 20:47:10 +01:00
dfl-fme.h fpga: dfl: fme: add global error reporting support 2019-09-03 19:35:41 -07:00
dfl-pci.c fpga: dfl: pci: enable SRIOV support. 2019-08-05 17:56:46 +02:00
dfl.c fpga: dfl: support multiple opens on feature device node. 2020-04-29 20:37:07 -07:00
dfl.h fpga: dfl.h: Replace zero-length array with flexible-array member 2020-04-29 20:37:12 -07:00
fpga-bridge.c drivers: Introduce device lookup variants by of_node 2019-07-30 13:07:41 +02:00
fpga-mgr.c drivers: Introduce device lookup variants by of_node 2019-07-30 13:07:41 +02:00
fpga-region.c fpga: add devm_fpga_region_create 2018-10-16 11:13:50 +02:00
ice40-spi.c fpga: ice40-spi: Use new structure for SPI transfer delays 2020-04-29 20:37:08 -07:00
Kconfig fpga: dfl: fme: add thermal management support 2019-10-16 19:18:27 -07:00
machxo2-spi.c fpga: machxo2-spi: Use new structure for SPI transfer delays 2020-04-29 20:37:08 -07:00
Makefile fpga: dfl: fme: add global error reporting support 2019-09-03 19:35:41 -07:00
of-fpga-region.c drivers: Add generic helper to match by of_node 2019-06-24 05:22:31 +02:00
socfpga-a10.c
socfpga.c
stratix10-soc.c fpga: stratix10-soc: add compatible property value for intel agilex 2020-04-29 20:37:10 -07:00
ts73xx-fpga.c fpga: remove redundant dev_err message 2020-01-02 20:57:34 -08:00
xilinx-pr-decoupler.c fpga: xilinx-pr-decoupler: Remove clk_get error message for probe defer 2020-01-10 12:51:56 -08:00
xilinx-spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
zynq-fpga.c fpga: Remove dev_err() usage after platform_get_irq() 2019-10-04 18:57:16 -07:00
zynqmp-fpga.c fpga: zynqmp-fpga: Correctly handle error pointer 2019-05-30 07:56:11 -07:00