2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-10 22:54:11 +08:00
linux-next/drivers/net/ethernet/netronome/nfp
Gustavo A. R. Silva af6f12f22b nfp: flower: cmsg: use struct_size() helper
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;
    void *entry[];
};

size = sizeof(struct foo) + count * sizeof(void *);
instance = alloc(size, GFP_KERNEL);

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

instance = alloc(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>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-02-08 22:57:28 -08:00
..
abm nfp: abm: allow to opt-out of RED offload 2018-12-16 12:41:42 -08:00
bpf nfp: bpf: complete ALU32 logic shift supports 2019-02-01 18:03:49 -08:00
flower nfp: flower: cmsg: use struct_size() helper 2019-02-08 22:57:28 -08:00
nfpcore nfp: nsp: add support for versions command 2019-02-01 15:30:31 -08:00
nic nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
Makefile nfp: abm: add cls_u32 offload for simple band classification 2018-11-19 18:53:46 -08:00
nfp_abi.h nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_app_nic.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_app.c nfp: add offloads on representors 2018-11-30 13:30:44 -08:00
nfp_app.h nfp: register a notifier handler in a central location for the device 2018-11-07 11:45:22 -08:00
nfp_asm.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_asm.h nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_devlink.c nfp: devlink: report the running and flashed versions 2019-02-01 15:30:31 -08:00
nfp_hwmon.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_main.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_main.h nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_net_common.c nfp: Implement ndo_get_port_parent_id() 2019-02-06 14:16:12 -08:00
nfp_net_ctrl.c nfp: add offset to all TLV parsing errors 2018-11-30 13:30:44 -08:00
nfp_net_ctrl.h nfp: add offloads on representors 2018-11-30 13:30:44 -08:00
nfp_net_debugdump.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_net_debugfs.c nfp: convert to DEFINE_SHOW_ATTRIBUTE 2018-12-03 17:33:38 -08:00
nfp_net_ethtool.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_net_main.c nfp: pass ctrl_bar pointer to nfp_net_alloc 2018-11-08 20:48:00 -08:00
nfp_net_repr.c nfp: Implement ndo_get_port_parent_id() 2019-02-06 14:16:12 -08:00
nfp_net_repr.h nfp: add offloads on representors 2018-11-30 13:30:44 -08:00
nfp_net_sriov.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_net_sriov.h nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_net.h nfp: report more info when reconfiguration fails 2018-11-30 13:30:45 -08:00
nfp_netvf_main.c nfp: pass ctrl_bar pointer to nfp_net_alloc 2018-11-08 20:48:00 -08:00
nfp_port.c nfp: Implement ndo_get_port_parent_id() 2019-02-06 14:16:12 -08:00
nfp_port.h nfp: Implement ndo_get_port_parent_id() 2019-02-06 14:16:12 -08:00
nfp_shared_buf.c net: devlink: report cell size of shared buffers 2019-02-03 11:25:34 -08:00