linux/drivers/net/ethernet/chelsio/cxgb3
Gustavo A. R. Silva db4863fdb8 cxgb3/l2t: Use struct_size() in kvzalloc()
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;
    struct boo entry[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = kvzalloc(size, GFP_KERNEL);

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

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

Notice that, in this case, variable size is not necessary, hence
it is removed.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01 15:01:46 -07:00
..
Makefile
adapter.h
ael1002.c
aq100x.c
common.h
cxgb3_ctl_defs.h
cxgb3_defs.h
cxgb3_ioctl.h
cxgb3_main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-10-06 14:43:42 -07:00
cxgb3_offload.c net: cxgb3: remove redundant null pointer check before kfree_skb 2018-09-21 09:04:37 -07:00
cxgb3_offload.h
firmware_exports.h
l2t.c cxgb3/l2t: Use struct_size() in kvzalloc() 2019-04-01 15:01:46 -07:00
l2t.h cxgb3/l2t: Fix undefined behaviour 2019-04-01 15:01:46 -07:00
mc5.c
regs.h
sge.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
sge_defs.h
t3_cpl.h
t3_hw.c net: cxgb3: fix various indentation issues 2019-01-10 09:30:08 -05:00
t3cdev.h
version.h
vsc8211.c
xgmac.c