mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-16 08:58:12 +07:00
4559dd2482
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> |
||
---|---|---|
.. | ||
hnae.c | ||
hnae.h | ||
hns_ae_adapt.c | ||
hns_dsaf_gmac.c | ||
hns_dsaf_gmac.h | ||
hns_dsaf_mac.c | ||
hns_dsaf_mac.h | ||
hns_dsaf_main.c | ||
hns_dsaf_main.h | ||
hns_dsaf_misc.c | ||
hns_dsaf_misc.h | ||
hns_dsaf_ppe.c | ||
hns_dsaf_ppe.h | ||
hns_dsaf_rcb.c | ||
hns_dsaf_rcb.h | ||
hns_dsaf_reg.h | ||
hns_dsaf_xgmac.c | ||
hns_dsaf_xgmac.h | ||
hns_enet.c | ||
hns_enet.h | ||
hns_ethtool.c | ||
Makefile |