linux_dsm_epyc7002/drivers/net/ethernet/hisilicon
Gustavo A. R. Silva d89ea4acfc 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) + sizeof(struct boo) * count, 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-02-27 21:47:42 -08:00
..
hns net: hns: use struct_size() in devm_kzalloc() 2019-02-27 21:47:42 -08:00
hns3 net: hns3: fix improper error handling for hns3_client_start 2019-02-24 20:27:50 -08:00
hip04_eth.c net: hisilicon: remove unexpected free_netdev 2018-11-28 10:41:15 -08:00
hisi_femac.c
hix5hd2_gmac.c cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
hns_mdio.c net: hns: Fix wrong read accesses via Clause 45 MDIO protocol 2019-01-27 23:01:56 -08:00
Kconfig hns3: prevent building without CONFIG_INET 2018-12-14 13:17:50 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00