linux_dsm_epyc7002/drivers/net/ethernet/hisilicon/hns
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
..
hnae.c net: hns: fix for unmapping problem when SMMU is on 2018-09-25 10:42:20 -07:00
hnae.h net: hns: add the code for cleaning pkt in chip 2018-08-29 18:08:20 -07:00
hns_ae_adapt.c net: hns: Fix use after free identified by SLUB debug 2019-01-04 13:33:57 -08:00
hns_dsaf_gmac.c net: hns: Add mac pcs config when enable|disable mac 2018-12-16 12:07:32 -08:00
hns_dsaf_gmac.h
hns_dsaf_mac.c net: hns: All ports can not work when insmod hns ko after rmmod. 2018-12-16 12:07:31 -08:00
hns_dsaf_mac.h net: hns: add the code for cleaning pkt in chip 2018-08-29 18:08:20 -07:00
hns_dsaf_main.c net: hns: Fix ping failed when use net bridge and send multicast 2018-12-16 12:07:32 -08:00
hns_dsaf_main.h net: hns: add the code for cleaning pkt in chip 2018-08-29 18:08:20 -07:00
hns_dsaf_misc.c net: hns: Make many functions static 2018-07-26 09:41:48 -07:00
hns_dsaf_misc.h net: hns: Add support of ACPI to HNS driver RoCE Reset function 2016-08-25 10:05:10 -04:00
hns_dsaf_ppe.c net: hns: add the code for cleaning pkt in chip 2018-08-29 18:08:20 -07:00
hns_dsaf_ppe.h net: hns: add the code for cleaning pkt in chip 2018-08-29 18:08:20 -07:00
hns_dsaf_rcb.c net: hns: Use struct_size() in devm_kzalloc() 2019-01-17 11:33:46 -08:00
hns_dsaf_rcb.h net: hns: add the code for cleaning pkt in chip 2018-08-29 18:08:20 -07:00
hns_dsaf_reg.h net: hns: Add mac pcs config when enable|disable mac 2018-12-16 12:07:32 -08:00
hns_dsaf_xgmac.c net: hisilicon: hns: Replace mdelay() with msleep() 2018-07-27 13:45:14 -07:00
hns_dsaf_xgmac.h net: hns: fix to intimate the link-status change by adding LF/RF method 2016-11-10 11:45:37 -05:00
hns_enet.c net: hns: Fix WARNING when hns modules installed 2019-01-04 13:33:57 -08:00
hns_enet.h net: hns: Add self-adaptive interrupt coalesce support in hns driver 2017-08-03 09:21:14 -07:00
hns_ethtool.c net: core: dev: Add extack argument to dev_open() 2018-12-06 13:26:06 -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