linux_dsm_epyc7002/drivers/net/can/usb/kvaser_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_core.c can: kvaser_usb: Use struct_size() in alloc_candev() 2019-07-24 10:31:53 +02:00
kvaser_usb_hydra.c can: kvaser_usb: Fix potential uninitialized variable use 2018-11-09 17:19:57 +01:00
kvaser_usb_leaf.c can: kvaser_usb: Simplify struct kvaser_cmd_cardinfo 2018-07-27 10:40:19 +02:00
kvaser_usb.h
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00