linux_dsm_epyc7002/drivers/net/can/usb
Gustavo A. R. Silva d9e5d174ad can: kvaser_usb: Use struct_size() in alloc_candev()
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 = alloc(sizeof(struct foo) + count * sizeof(void *));

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

instance = alloc(struct_size(instance, entry, count));

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2019-07-24 10:31:53 +02:00
..
kvaser_usb can: kvaser_usb: Use struct_size() in alloc_candev() 2019-07-24 10:31:53 +02:00
peak_usb treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ems_usb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 164 2019-05-30 11:26:38 -07:00
esd_usb2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 164 2019-05-30 11:26:38 -07:00
gs_usb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
Kconfig can: usb: Kconfig: Remove duplicate menu entry 2019-06-07 23:03:53 +02:00
Makefile can: kvaser_usb: Split driver into kvaser_usb_core.c and kvaser_usb_leaf.c 2018-07-27 10:40:19 +02:00
mcba_usb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 412 2019-06-05 17:37:14 +02:00
ucan.c can: ucan: fix spelling mistake: "resumbmitting" -> "resubmitting" 2018-11-28 16:19:52 +01:00
usb_8dev.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 412 2019-06-05 17:37:14 +02:00