linux_dsm_epyc7002/net/decnet
Gustavo A. R. Silva bb3e16ad8b net, decnet: 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 13:22:10 -08:00
..
netfilter
af_decnet.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-12-27 13:04:52 -08:00
dn_dev.c decnet: Remove unnecessary check for dev->name 2018-09-21 19:48:36 -07:00
dn_fib.c net, decnet: use struct_size() in kzalloc() 2019-01-16 13:22:10 -08:00
dn_neigh.c
dn_nsp_in.c
dn_nsp_out.c
dn_route.c mm: convert totalram_pages and totalhigh_pages variables to atomic 2018-12-28 12:11:47 -08:00
dn_rules.c
dn_table.c
dn_timer.c
Kconfig
Makefile
README
sysctl_net_decnet.c
TODO

                       Linux DECnet Project
                      ======================

The documentation for this kernel subsystem is available in the
Documentation/networking subdirectory of this distribution and also
on line at http://www.chygwyn.com/DECnet/

Steve Whitehouse <SteveW@ACM.org>