linux/net/openvswitch
Gustavo A. R. Silva c5c3899de0 openvswitch: meter: Use struct_size() in 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 = kzalloc(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 = kzalloc(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-16 21:10:47 -08:00
..
actions.c OVS: remove use of VLAN_TAG_PRESENT 2018-11-08 19:49:31 -08:00
conntrack.c openvswitch: fix spelling mistake "execeeds" -> "exceeds" 2018-11-30 13:18:09 -08:00
conntrack.h openvswitch: Support conntrack zone limit 2018-05-25 16:45:19 -04:00
datapath.c openvswitch: Use correct reply values in datapath and vport ops 2018-09-29 11:44:11 -07:00
datapath.h openvswitch: Support conntrack zone limit 2018-05-25 16:45:19 -04:00
dp_notify.c openvswitch: reliable interface indentification in port dumps 2017-11-05 21:49:17 +09:00
flow_netlink.c OVS: remove use of VLAN_TAG_PRESENT 2018-11-08 19:49:31 -08:00
flow_netlink.h openvswitch: enable NSH support 2017-11-08 16:12:33 +09:00
flow_table.c openvswitch: Optimize operations for OvS flow_stats. 2017-07-19 13:49:39 -07:00
flow_table.h openvswitch: Zero flows on allocation. 2015-09-22 17:33:41 -07:00
flow.c openvswitch: Fix IPv6 later frags parsing 2019-01-04 13:00:02 -08:00
flow.h OVS: remove use of VLAN_TAG_PRESENT 2018-11-08 19:49:31 -08:00
Kconfig openvswitch: Support conntrack zone limit 2018-05-25 16:45:19 -04:00
Makefile openvswitch: Add meter infrastructure 2017-11-13 10:37:07 +09:00
meter.c openvswitch: meter: Use struct_size() in kzalloc() 2019-01-16 21:10:47 -08:00
meter.h openvswitch: Add meter infrastructure 2017-11-13 10:37:07 +09:00
vport-geneve.c net: core: dev: Add extack argument to dev_change_flags() 2018-12-06 13:26:07 -08:00
vport-gre.c net: core: dev: Add extack argument to dev_change_flags() 2018-12-06 13:26:07 -08:00
vport-internal_dev.c net: ovs: fix return type of ndo_start_xmit function 2018-09-28 10:25:11 -07:00
vport-internal_dev.h openvswitch: introduce rtnl ops stub 2014-07-01 14:40:17 -07:00
vport-netdev.c openvswitch: remove BUG_ON from get_dpdev 2018-11-08 17:14:59 -08:00
vport-netdev.h openvswitch: Use dev_queue_xmit for vport send. 2015-10-22 06:46:16 -07:00
vport-vxlan.c net: core: dev: Add extack argument to dev_change_flags() 2018-12-06 13:26:07 -08:00
vport.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
vport.h openvswitch: pass mac_proto to ovs_vport_send 2016-11-13 00:51:02 -05:00