linux_dsm_epyc7002/drivers/net/ethernet/chelsio
Gustavo A. R. Silva c49f0ce0b6 cxgb4: smt: use struct_size() in kvzalloc()
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 = kvzalloc(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 = kvzalloc(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-02-01 15:12:29 -08:00
..
cxgb net: chelsio: cxgb2: remove unused array pci_speed 2018-08-10 10:24:50 -07:00
cxgb3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-01-16 05:13:36 +12:00
cxgb4 cxgb4: smt: use struct_size() in kvzalloc() 2019-02-01 15:12:29 -08:00
cxgb4vf cxgb4vf: Update port information in cxgb4vf_open() 2019-01-29 09:50:36 -08:00
libcxgb libcxgb: replace vmalloc and memset with vzalloc 2018-07-21 16:32:59 -07:00
Kconfig net: documentation: build a directory structure for drivers 2018-12-05 11:30:06 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00