linux/drivers/input/keyboard
Gustavo A. R. Silva a1b9b65edf Input: gpio_keys - 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/20200213002600.GA31916@embeddedor.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-02-13 17:09:47 -08:00
..
adc-keys.c Input: adc-keys - switch to using polled mode of input devices 2019-10-29 17:13:42 -07:00
adp5520-keys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
adp5588-keys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
adp5589-keys.c Input: adp5589 - make keypad support optional 2019-10-23 16:24:13 -07:00
amikbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
applespi_trace.h Input: add Apple SPI keyboard and trackpad driver 2019-07-19 11:58:34 +03:00
applespi.c Input: applespi - no need to check return value of debugfs_create functions 2019-08-12 00:10:59 -07:00
applespi.h Input: add Apple SPI keyboard and trackpad driver 2019-07-19 11:58:34 +03:00
atakbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
atkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
bcm-keypad.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
cap11xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
clps711x-keypad.c Input: clps711x-keypad - switch to using polled mode of input devices 2019-10-29 17:13:43 -07:00
cros_ec_keyb.c Revert "Input: cros_ec_keyb: mask out extra flags in event_type" 2019-11-21 11:23:16 +01:00
davinci_keyscan.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
dlink-dir685-touchkeys.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ep93xx_keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
goldfish_events.c Input: goldfish_events - replace zero-length array with flexible-array member 2020-02-13 17:09:47 -08:00
gpio_keys_polled.c Input: gpio_keys_polled - switch to using polled mode of input devices 2019-10-29 17:13:45 -07:00
gpio_keys.c Input: gpio_keys - replace zero-length array with flexible-array member 2020-02-13 17:09:47 -08:00
hil_kbd.c Input: hil_kbd - constify serio_device_id 2017-08-18 17:14:20 -07:00
hilkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 377 2019-06-05 17:37:10 +02:00
hpps2atkbd.h
imx_keypad.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
imx_sc_key.c Input: imx_sc_key - only take the valid data from SCU firmware as key state 2019-12-13 16:41:57 -08:00
ipaq-micro-keys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
jornada680_kbd.c Input: jornada680_kbd - switch to using polled mode of input devices 2019-10-29 17:13:44 -07:00
jornada720_kbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Kconfig Input: snvs_pwrkey - send key events for i.MX6 S, DL and Q 2019-11-25 13:32:11 -08:00
lkkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
lm8323.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 394 2019-06-05 17:37:12 +02:00
lm8333.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 178 2019-05-30 11:29:19 -07:00
locomokbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
lpc32xx-keys.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
Makefile Input: keyboard - imx_sc: Add i.MX system controller key support 2019-10-15 17:43:55 -07:00
maple_keyb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 64 2019-05-24 17:36:46 +02:00
matrix_keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
max7359_keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mcs_touchkey.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mpr121_touchkey.c Input: mpr121 - add polling mode 2019-10-15 17:43:54 -07:00
mtk-pmic-keys.c Linux 5.2 2019-07-15 09:42:32 -07:00
newtonkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
nomadik-ske-keypad.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
nspire-keypad.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
omap4-keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
omap-keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
opencores-kbd.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
pmic8xxx-keypad.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
pxa27x_keypad.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
pxa930_rotary.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
qt1050.c Input: qt1050 - add Microchip AT42QT1050 support 2019-05-07 14:12:43 -07:00
qt1070.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
qt2160.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
samsung-keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sh_keysc.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
snvs_pwrkey.c Input: snvs_pwrkey - remove gratuitous NULL initializers 2019-12-04 17:56:55 -08:00
spear-keyboard.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
st-keyscan.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
stmpe-keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 464 2019-06-19 17:09:10 +02:00
stowaway.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sun4i-lradc-keys.c Linux 5.2 2019-07-15 09:42:32 -07:00
sunkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
tc3589x-keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 464 2019-06-19 17:09:10 +02:00
tca6416-keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tca8418_keypad.c Input: tca8418 - remove set but not used variable 'max_keys' 2019-05-27 19:01:42 -07:00
tegra-kbc.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
tm2-touchkey.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
twl4030_keypad.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
xtkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00