OpenCloudOS-Kernel/drivers/net/wan
Gustavo A. R. Silva a3deec5b3f wan: wanxl: 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[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
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 alloc_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>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-02-08 22:57:28 -08:00
..
lmc net: lmc: remove -I. header search path 2019-01-26 18:27:04 -08:00
.gitignore
Kconfig net: wan: slic_ds26522: Allow driver to built if COMPILE_TEST is enabled 2016-10-14 10:11:49 -04:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
c101.c net: wan: remove redundant include 2018-09-18 20:08:08 -07:00
cosa.c the rest of drivers/*: annotate ->poll() instances 2017-11-28 11:06:58 -05:00
cosa.h
dlci.c net: Fix inconsistent teardown and release of private netdev state. 2017-06-07 15:53:24 -04:00
dscc4.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-02-08 15:00:17 -08:00
farsync.c farsync: remove redundant variable txq_length 2018-07-07 20:49:08 +09:00
farsync.h
fsl_ucc_hdlc.c net: fsl_ucc_hdlc: replace dev_kfree_skb_irq by dev_consume_skb_irq for drop profiles 2019-02-06 17:38:15 -08:00
fsl_ucc_hdlc.h net/wan/fsl_ucc_hdlc: hmask 2018-09-03 22:14:41 -07:00
hd64570.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
hd64570.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hd64572.c drivers: net: generalize napi_complete_done() 2017-01-30 15:10:42 -05:00
hd64572.h
hdlc.c net: use core MTU range checking in WAN drivers 2016-10-20 14:51:09 -04:00
hdlc_cisco.c hdlc: Convert timers to use timer_setup() 2017-10-18 12:39:55 +01:00
hdlc_fr.c hdlc: Convert timers to use timer_setup() 2017-10-18 12:39:55 +01:00
hdlc_ppp.c hdlc_ppp: carrier detect ok, don't turn off negotiation 2018-02-26 14:38:12 -05:00
hdlc_raw.c
hdlc_raw_eth.c net: make struct net_device::tx_queue_len unsigned int 2017-05-18 10:19:30 -04:00
hdlc_x25.c
hostess_sv11.c Annotate hardware config module parameters in drivers/net/wan/ 2017-04-20 12:02:32 +01:00
ixp4xx_hss.c net: use core MTU range checking in WAN drivers 2016-10-20 14:51:09 -04:00
lapbether.c net: lapbether: fix double free 2017-11-01 12:11:02 +09:00
n2.c net: use core MTU range checking in WAN drivers 2016-10-20 14:51:09 -04:00
pc300too.c wan: pc300too: abort path on failure 2017-04-24 15:51:31 -04:00
pci200syn.c net: wan: remove redundant include 2018-09-18 20:08:08 -07:00
sbni.c drivers/net: wan/sbni: Convert timers to use timer_setup() 2017-10-25 13:20:30 +09:00
sbni.h
sdla.c drivers/net: wan/sdla: Convert timers to use timer_setup() 2017-10-27 12:09:16 +09:00
sealevel.c Annotate hardware config module parameters in drivers/net/wan/ 2017-04-20 12:02:32 +01:00
slic_ds26522.c net: wan: slic_ds26522: Remove .owner field for driver 2017-02-07 11:41:15 -05:00
slic_ds26522.h
wanxl.c wan: wanxl: use struct_size() in kzalloc() 2019-02-08 22:57:28 -08:00
wanxl.h
wanxlfw.S
wanxlfw.inc_shipped
x25_asy.c net/wan: fix a double free in x25_asy_open_tty() 2018-12-30 20:22:48 -08:00
x25_asy.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
z85230.c drivers/net/wan/z85230.c: Use designated initializers 2017-08-01 17:04:38 -07:00
z85230.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00