* [PATCH net-next] rocker: replace fixed stack allocation with dynamic allocation
@ 2015-03-16 6:04 sfeldma
2015-03-16 6:40 ` Jiri Pirko
2015-03-16 19:57 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: sfeldma @ 2015-03-16 6:04 UTC (permalink / raw)
To: netdev; +Cc: jiri
From: Scott Feldman <sfeldma@gmail.com>
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: Scott Feldman <sfeldma@gmail.com>
---
drivers/net/ethernet/rocker/rocker.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index bc5f27a..2511ae2 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -2955,11 +2955,16 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port,
struct rocker_port *p;
struct rocker *rocker = rocker_port->rocker;
u32 group_id = ROCKER_GROUP_L2_FLOOD(vlan_id, 0);
- u32 group_ids[ROCKER_FP_PORTS_MAX];
+ u32 *group_ids;
u8 group_count = 0;
- int err;
+ int err = 0;
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
* references an L2 interface group for each port in this
* VLAN.
@@ -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 (group_count == 0)
- return 0;
+ goto no_ports_in_vlan;
err = rocker_group_l2_flood(rocker_port, flags, vlan_id,
group_count, group_ids,
@@ -2986,6 +2991,8 @@ static int rocker_port_vlan_flood_group(struct rocker_port *rocker_port,
netdev_err(rocker_port->dev,
"Error (%d) port VLAN l2 flood group\n", err);
+no_ports_in_vlan:
+ kfree(group_ids);
return err;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] rocker: replace fixed stack allocation with dynamic allocation
2015-03-16 6:04 [PATCH net-next] rocker: replace fixed stack allocation with dynamic allocation sfeldma
@ 2015-03-16 6:40 ` Jiri Pirko
2015-03-16 19:57 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2015-03-16 6:40 UTC (permalink / raw)
To: sfeldma; +Cc: netdev
Mon, Mar 16, 2015 at 07:04:46AM CET, sfeldma@gmail.com wrote:
>From: Scott Feldman <sfeldma@gmail.com>
>
>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: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] rocker: replace fixed stack allocation with dynamic allocation
2015-03-16 6:04 [PATCH net-next] rocker: replace fixed stack allocation with dynamic allocation sfeldma
2015-03-16 6:40 ` Jiri Pirko
@ 2015-03-16 19:57 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-03-16 19:57 UTC (permalink / raw)
To: sfeldma; +Cc: netdev, jiri
From: sfeldma@gmail.com
Date: Sun, 15 Mar 2015 23:04:46 -0700
> From: Scott Feldman <sfeldma@gmail.com>
>
> 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: Scott Feldman <sfeldma@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-16 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-16 6:04 [PATCH net-next] rocker: replace fixed stack allocation with dynamic allocation sfeldma
2015-03-16 6:40 ` Jiri Pirko
2015-03-16 19:57 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).