1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/wireless/intel/iwlwifi/fw/api
Gustavo A. R. Silva 45c21a0e5b iwlwifi: Replace zero-length array with flexible-array
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]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

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 <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507185538.GA14674@embeddedor
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-06-10 15:22:16 +03:00
..
alive.h iwlwifi: add FW recovery flow 2019-02-14 11:29:45 +02:00
binding.h iwlwifi: mvm: Add new quota command API 2017-10-06 14:57:21 +03:00
cmdhdr.h iwlwifi: fw api: fix various kernel-doc warnings 2017-08-01 12:41:43 +03:00
coex.h iwlwifi: mvm: support Coex Schema 2 2018-08-31 11:38:30 +03:00
commands.h iwlwifi: mvm: add soc latency support 2020-03-27 08:12:46 +02:00
config.h iwlwifi: mvm: add framework for specific phy configuration 2020-04-24 16:38:10 +03:00
context.h
d3.h iwlwifi: support version 9 of WOWLAN_GET_STATUS notification 2020-04-24 16:38:09 +03:00
datapath.h iwlwifi: mvm: implement CSI reporting 2019-01-29 16:10:32 +02:00
dbg-tlv.h iwlwifi: yoyo: don't access TLV before verifying len 2020-05-08 09:50:46 +03:00
debug.h iwlwifi: yoyo: add support for parsing SHARED_MEM_ALLOC version 4 2020-05-08 09:50:34 +03:00
filter.h
led.h iwlwifi: mvm: use firmware LED command where applicable 2017-08-09 09:15:32 +03:00
location.h iwlwifi: mvm: add support for range request version 10 2020-05-29 10:32:41 +03:00
mac-cfg.h iwlwifi: mvm: add notification for missed VAP 2019-10-25 10:10:14 +03:00
mac.h iwlwifi: mvm: Block 26-tone RU OFDMA transmissions 2019-09-06 15:31:11 +03:00
nvm-reg.h iwlwifi: Replace zero-length array with flexible-array 2020-06-10 15:22:16 +03:00
offload.h
paging.h iwlwifi: remove host assisted paging 2017-11-03 11:56:08 +02:00
phy-ctxt.h iwlwifi: mvm: Change FW channel info API 2019-01-29 16:10:32 +02:00
phy.h iwlwifi: support per-platform antenna gain 2019-09-06 15:31:20 +03:00
power.h iwlwifi: support per-platform antenna gain 2019-09-06 15:31:20 +03:00
rs.h iwlwifi: mvm: name magic numbers with enum 2019-09-06 15:31:15 +03:00
rx.h iwlwifi: fw api: fix PHY data 2/3 position 2020-05-08 09:50:29 +03:00
scan.h iwlwifi: scan: remove support for fw scan api v13 2020-04-24 13:29:30 +03:00
sf.h
soc.h iwlwifi: mvm: tell firmware about required LTR delay 2020-04-24 16:38:11 +03:00
sta.h iwlwifi: remove deprecated and unused iwl_mvm_keyinfo struct 2020-04-24 16:38:10 +03:00
stats.h iwlwifi: mvm: fix firmware statistics usage 2019-01-25 20:57:19 +02:00
tdls.h iwlwifi: mvm: Change FW channel info API 2019-01-29 16:10:32 +02:00
time-event.h iwlwifi: mvm: sync the iwl_mvm_session_prot_notif layout 2019-11-15 09:34:30 +02:00
tx.h iwlwifi: mvm: fix gcc-10 zero-length-bounds warning 2020-06-09 15:27:52 +03:00
txq.h iwlwifi: mvm: limit maximum queue appropriately 2020-04-21 15:39:03 +03:00