linux_dsm_epyc7002/drivers/net/ethernet
Gustavo A. R. Silva 4559dd2482 net: hns: Use struct_size() in devm_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;
    struct boo entry[];
};

instance = devm_kzalloc(dev, sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL);

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

instance = devm_kzalloc(dev, 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: David S. Miller <davem@davemloft.net>
2019-01-17 11:33:46 -08:00
..
3com
8390
adaptec
aeroflex cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
agere
alacritech cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
allwinner
alteon
altera
amazon cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
amd net: ethernet: don't set phylib state CHANGELINK in drivers 2018-12-18 22:07:20 -08:00
apm cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
apple
aquantia
arc
atheros cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
aurora
broadcom bnx2x: fix various indentation issues 2019-01-16 14:03:27 -08:00
brocade
cadence net: macb: remove unnecessary code 2019-01-04 12:59:09 -08:00
calxeda
cavium cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
chelsio cxgb4/l2t: Use struct_size() in kvzalloc() 2019-01-16 21:11:09 -08:00
cirrus
cisco
cortina
davicom
dec
dlink
emulex cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
ezchip
faraday cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
freescale fsl/fman: Use GFP_ATOMIC in {memac,tgec}_add_hash_mac_address() 2018-12-28 21:54:12 -08:00
fujitsu
hisilicon net: hns: Use struct_size() in devm_kzalloc() 2019-01-17 11:33:46 -08:00
hp
huawei net-next/hinic: replace disable_irq_nosync/enable_irq 2019-01-17 11:22:36 -08:00
i825xx
ibm cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
intel Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 2019-01-15 15:48:00 -08:00
marvell Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
mediatek Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
mellanox mlxsw: spectrum_nve: Use struct_size() in kzalloc() 2019-01-16 09:12:23 -08:00
micrel
microchip lan743x: Remove phy_read from link status change function 2019-01-08 16:26:12 -05:00
moxa
mscc USB/PHY patches for 4.21-rc1 2018-12-28 20:30:00 -08:00
myricom cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
natsemi
neterion Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-12-20 11:53:36 -08:00
netronome nfp: flower: enable MAC address sharing for offloadable devs 2019-01-16 15:23:15 -08:00
ni cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
nuvoton w90p910_ether: remove incorrect __init annotation 2018-12-14 14:42:51 -08:00
nvidia
nxp
oki-semi cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
packetengines
pasemi cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
qlogic Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
qualcomm cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
rdc
realtek drivers: net: atp: fix various indentation issues 2019-01-16 14:04:22 -08:00
renesas
rocker
samsung cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
seeq
sfc cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
sgi cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
silan
sis
smsc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-12-27 13:04:52 -08:00
socionext cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
stmicro Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
sun net: sungem: fix indentation, remove a tab 2019-01-16 14:04:59 -08:00
synopsys
tehuti
ti Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-03 12:53:47 -08:00
toshiba
tundra cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
via
wiznet
xilinx cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
xircom
xscale
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c
jme.h
Kconfig
korina.c
lantiq_etop.c
lantiq_xrx200.c
Makefile
netx-eth.c