Commit 588dc911 authored by Wang Shaoyan's avatar Wang Shaoyan Committed by David S. Miller

gianfar: reduce stack usage in gianfar_ethtool.c

  drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
Signed-off-by: default avatarWang Shaoyan <wangshaoyan.pt@taobao.com>
Reviewed-and-tested-by: default avatarSebastian Pöhn <sebastian.poehn@belden.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 320f24e4
...@@ -686,10 +686,21 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u ...@@ -686,10 +686,21 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
{ {
unsigned int last_rule_idx = priv->cur_filer_idx; unsigned int last_rule_idx = priv->cur_filer_idx;
unsigned int cmp_rqfpr; unsigned int cmp_rqfpr;
unsigned int local_rqfpr[MAX_FILER_IDX + 1]; unsigned int *local_rqfpr;
unsigned int local_rqfcr[MAX_FILER_IDX + 1]; unsigned int *local_rqfcr;
int i = 0x0, k = 0x0; int i = 0x0, k = 0x0;
int j = MAX_FILER_IDX, l = 0x0; int j = MAX_FILER_IDX, l = 0x0;
int ret = 1;
local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
GFP_KERNEL);
local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
GFP_KERNEL);
if (!local_rqfpr || !local_rqfcr) {
pr_err("Out of memory\n");
ret = 0;
goto err;
}
switch (class) { switch (class) {
case TCP_V4_FLOW: case TCP_V4_FLOW:
...@@ -706,7 +717,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u ...@@ -706,7 +717,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
break; break;
default: default:
pr_err("Right now this class is not supported\n"); pr_err("Right now this class is not supported\n");
return 0; ret = 0;
goto err;
} }
for (i = 0; i < MAX_FILER_IDX + 1; i++) { for (i = 0; i < MAX_FILER_IDX + 1; i++) {
...@@ -721,7 +733,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u ...@@ -721,7 +733,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
if (i == MAX_FILER_IDX + 1) { if (i == MAX_FILER_IDX + 1) {
pr_err("No parse rule found, can't create hash rules\n"); pr_err("No parse rule found, can't create hash rules\n");
return 0; ret = 0;
goto err;
} }
/* If a match was found, then it begins the starting of a cluster rule /* If a match was found, then it begins the starting of a cluster rule
...@@ -765,7 +778,10 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u ...@@ -765,7 +778,10 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
priv->cur_filer_idx = priv->cur_filer_idx - 1; priv->cur_filer_idx = priv->cur_filer_idx - 1;
} }
return 1; err:
kfree(local_rqfcr);
kfree(local_rqfpr);
return ret;
} }
static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd) static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
......
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