mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
net: dsa: Remove VLA usage
We avoid 2 VLAs by using a pre-allocated field in dsa_switch. We also try to avoid dynamic allocation whenever possible (when using fewer than bits-per-long ports, which is the common case). Link: http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Link: http://lkml.kernel.org/r/20180505185145.GB32630@lunn.ch Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com> [kees: tweak commit subject and message slightly] Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
14260e9170
commit
0015b80abc
3 changed files with 27 additions and 12 deletions
|
@ -259,6 +259,9 @@ struct dsa_switch {
|
|||
/* Number of switch port queues */
|
||||
unsigned int num_tx_queues;
|
||||
|
||||
unsigned long *bitmap;
|
||||
unsigned long _bitmap;
|
||||
|
||||
/* Dynamically allocated ports, keep last */
|
||||
size_t num_ports;
|
||||
struct dsa_port ports[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue