android_kernel_samsung_sm8650/include/linux/usb
Gustavo A. R. Silva 6bc3f3979e USB: 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>
Link: https://lore.kernel.org/r/20200220132017.GA29262@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-23 19:24:51 +01:00
..
audio-v2.h USB: Replace zero-length array with flexible-array member 2020-02-23 19:24:51 +01:00
audio-v3.h USB: Replace zero-length array with flexible-array member 2020-02-23 19:24:51 +01:00
audio.h
c67x00.h
ccid.h
cdc_ncm.h
cdc-wdm.h
cdc.h
ch9.h usb: common: Separated decoding functions from dwc3 driver. 2019-08-29 10:52:27 +03:00
chipidea.h
composite.h
ehci_def.h usb: host: ehci-platform: add a quirk to avoid stuck 2020-02-10 11:15:27 -08:00
ehci_pdriver.h
ehci-dbgp.h
ezusb.h
functionfs.h
g_hid.h
gadget_configfs.h
gadget.h USB: Replace zero-length array with flexible-array member 2020-02-23 19:24:51 +01:00
hcd.h USB: Replace zero-length array with flexible-array member 2020-02-23 19:24:51 +01:00
input.h
iowarrior.h
irda.h USB: serial: ir-usb: fix link-speed handling 2020-01-23 09:11:16 +01:00
isp116x.h
isp1301.h
isp1362.h
isp1760.h
m66592.h
musb-ux500.h
musb.h
net2280.h
of.h
ohci_pdriver.h
otg-fsm.h
otg.h
pd_ado.h
pd_bdo.h
pd_ext_sdb.h
pd_vdo.h usb: pd: Add definition for DFP and UFP1 VDOs 2020-01-09 10:48:55 +01:00
pd.h usb: pd: Add definitions for the Enter_USB message 2020-01-09 10:48:55 +01:00
phy_companion.h
phy.h
quirks.h
r8a66597.h
renesas_usbhs.h usb: renesas_usbhs: Switch to GPIO descriptor 2019-12-30 20:37:42 +01:00
rndis_host.h
role.h usb: roles: Add usb_role_switch_find_by_fwnode() 2019-11-04 15:05:25 +01:00
serial.h
sl811.h
storage.h
tcpm.h usb: typec: tcpm: Remove tcpc_config configuration mechanism 2019-11-16 14:45:31 +01:00
tegra_usb_phy.h usb: phy: tegra: Use device-tree notion of reset-GPIO's active-state 2020-01-09 16:21:58 +01:00
typec_altmode.h usb: typec: altmode: Remove the notification chain 2020-02-12 10:51:21 -08:00
typec_dp.h
typec_mux.h usb: typec: Give the mux drivers all the details regarding the port state 2020-01-09 10:50:13 +01:00
typec.h usb: typec: Fix the description of struct typec_capability 2020-02-12 10:51:21 -08:00
uas.h
ulpi.h usb: ulpi: Add resource-managed variant of otg_ulpi_create() 2020-01-09 16:21:57 +01:00
usb338x.h usb: gadget: net2280: Move all "ll" registers in one structure 2019-08-30 09:14:38 +03:00
usb_phy_generic.h usb: phy-generic: Delete unused platform data 2020-01-15 10:39:20 +01:00
usbnet.h netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
xhci-dbgp.h