linux_dsm_epyc7002/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
..
adapter.h net: cxgb3: Use net_device_stats from struct net_device 2017-04-07 07:03:33 -07:00
ael1002.c
aq100x.c
common.h
cxgb3_ctl_defs.h
cxgb3_defs.h treewide: use kv[mz]alloc* rather than opencoded variants 2017-05-08 17:15:13 -07:00
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
Makefile
mc5.c
regs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sge_defs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sge.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
t3_cpl.h
t3_hw.c net: cxgb3: fix various indentation issues 2019-01-10 09:30:08 -05:00
t3cdev.h RDMA/cxgb3: Annotate an RCU pointer 2017-10-14 20:47:05 -04:00
version.h
vsc8211.c
xgmac.c