kernel_optimize_test/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
conntrack.c
conntrack.h
datapath.c
datapath.h
dp_notify.c
flow_netlink.c
flow_netlink.h
flow_table.c
flow_table.h
flow.c openvswitch: Fix IPv6 later frags parsing 2019-01-04 13:00:02 -08:00
flow.h
Kconfig
Makefile
meter.c openvswitch: meter: Use struct_size() in kzalloc() 2019-01-16 21:10:47 -08:00
meter.h
vport-geneve.c
vport-gre.c
vport-internal_dev.c
vport-internal_dev.h
vport-netdev.c
vport-netdev.h
vport-vxlan.c
vport.c
vport.h