Commit 04f49faf authored by Scott Feldman's avatar Scott Feldman Committed by David S. Miller

rocker: replace fixed stack allocation with dynamic allocation

In hast to fix some sparse warning, I hard-coded a fix-sized array on the stack
which is probably too big for kernel standards.  Fix this by converting array
to dynamic allocation.
Signed-off-by: default avatarScott Feldman <sfeldma@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b35f504a
...@@ -2955,11 +2955,16 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port, ...@@ -2955,11 +2955,16 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port,
struct rocker_port *p; struct rocker_port *p;
struct rocker *rocker = rocker_port->rocker; struct rocker *rocker = rocker_port->rocker;
u32 group_id = ROCKER_GROUP_L2_FLOOD(vlan_id, 0); u32 group_id = ROCKER_GROUP_L2_FLOOD(vlan_id, 0);
u32 group_ids[ROCKER_FP_PORTS_MAX]; u32 *group_ids;
u8 group_count = 0; u8 group_count = 0;
int err; int err = 0;
int i; int i;
group_ids = kcalloc(rocker->port_count, sizeof(u32),
rocker_op_flags_gfp(flags));
if (!group_ids)
return -ENOMEM;
/* Adjust the flood group for this VLAN. The flood group /* Adjust the flood group for this VLAN. The flood group
* references an L2 interface group for each port in this * references an L2 interface group for each port in this
* VLAN. * VLAN.
...@@ -2977,7 +2982,7 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port, ...@@ -2977,7 +2982,7 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port,
/* If there are no bridged ports in this VLAN, we're done */ /* If there are no bridged ports in this VLAN, we're done */
if (group_count == 0) if (group_count == 0)
return 0; goto no_ports_in_vlan;
err = rocker_group_l2_flood(rocker_port, flags, vlan_id, err = rocker_group_l2_flood(rocker_port, flags, vlan_id,
group_count, group_ids, group_count, group_ids,
...@@ -2986,6 +2991,8 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port, ...@@ -2986,6 +2991,8 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port,
netdev_err(rocker_port->dev, netdev_err(rocker_port->dev,
"Error (%d) port VLAN l2 flood group\n", err); "Error (%d) port VLAN l2 flood group\n", err);
no_ports_in_vlan:
kfree(group_ids);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment