alistair23-linux/drivers/input
Gustavo A. R. Silva a73450036e Input: mcs_touchkey - use struct_size() in kzalloc()
One of the more common cases of allocation size calculations is finding the
size of a structure that has a zero-sized array at the end, along with memory
for some number of elements for that array. For example:

struct foo {
    int stuff;
    void *entry[];
};

instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can now
use the new struct_size() helper:

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-01-13 22:48:55 -08:00
..
gameport
joystick Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2018-12-04 08:47:04 -08:00
keyboard Input: mcs_touchkey - use struct_size() in kzalloc() 2019-01-13 22:48:55 -08:00
misc Linux 4.20 2019-01-13 22:35:32 -08:00
mouse Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2018-12-21 09:09:30 -08:00
rmi4
serio Linux 4.20 2019-01-13 22:35:32 -08:00
tablet Input: aiptek - replace GFP_ATOMIC with GFP_KERNEL in aiptek_probe() 2018-07-27 11:59:10 -07:00
touchscreen Linux 4.20 2019-01-13 22:35:32 -08:00
apm-power.c
evbug.c
evdev.c Input: evdev - add a schedule point in evdev_write() 2018-10-05 11:42:31 -07:00
ff-core.c
ff-memless.c
input-compat.c
input-compat.h
input-leds.c
input-mt.c
input-polldev.c
input.c Input: do not use WARN() in input_alloc_absinfo() 2018-08-08 11:23:47 -07:00
joydev.c
Kconfig
Makefile
matrix-keymap.c
mousedev.c Input: mousedev - add a schedule point in mousedev_write() 2018-10-04 17:42:26 -07:00
sparse-keymap.c