From: Eric Dumazet <eric.dumazet@gmail.com>
To: stufever@gmail.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net, Sandeep.Kumar@freescale.com,
Wang Shaoyan <wangshaoyan.pt@taobao.com>
Subject: Re: [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c
Date: Tue, 09 Aug 2011 17:43:44 +0200 [thread overview]
Message-ID: <1312904624.2371.40.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> (raw)
In-Reply-To: <1312903103-1734-1-git-send-email-wangshaoyan.pt@taobao.com>
Le mardi 09 août 2011 à 23:18 +0800, stufever@gmail.com a écrit :
> From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
>
> drivers/net/gianfar_ethtool.c:765: warning: the frame size of 2048 bytes is larger than 1024 bytes
>
> Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
> ---
> drivers/net/gianfar_ethtool.c | 26 +++++++++++++++++++++++---
> 1 files changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
> index 6e35069..039e9c3 100644
> --- a/drivers/net/gianfar_ethtool.c
> +++ b/drivers/net/gianfar_ethtool.c
> @@ -686,10 +686,26 @@ 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 cmp_rqfpr;
> - unsigned int local_rqfpr[MAX_FILER_IDX + 1];
> - unsigned int local_rqfcr[MAX_FILER_IDX + 1];
> + unsigned int *local_rqfpr;
> + unsigned int *local_rqfcr;
> int i = 0x0, k = 0x0;
> int j = MAX_FILER_IDX, l = 0x0;
> + int ret = 1;
> +
> + local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> + GFP_KERNEL);
> + if (local_rqfpr) {
if (!local_rqfpr) {
> + pr_err("Out of memory\n");
> + ret = 0;
> + got err;
> + }
> + local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1),
> + GFP_KERNEL);
> + if (local_rqfcr) {
same here : if (!local_rqfcr) ...
> + pr_err("Out of memory\n");
> + ret = 0;
> + goto err1;
> + }
>
> switch (class) {
> case TCP_V4_FLOW:
> @@ -765,7 +781,11 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
> priv->cur_filer_idx = priv->cur_filer_idx - 1;
> }
>
> - return 1;
> + kfree(local_rqfcr);
> +err1:
> + kfree(local_rqfpr);
> +err:
> + return ret;
> }
>
> static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
next prev parent reply other threads:[~2011-08-09 15:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-09 15:18 [PATCH] gianfar: reduce stack usage in gianfar_ethtool.c stufever
2011-08-09 15:43 ` Eric Dumazet [this message]
2011-08-09 16:02 ` Wang Shaoyan
-- strict thread matches above, loose matches on Subject: below --
2011-08-09 15:45 stufever
2011-08-09 15:50 ` David Miller
2011-08-09 16:06 ` Wang Shaoyan
2011-08-09 16:08 ` Joe Perches
2011-08-09 16:37 ` Wang Shaoyan
2011-08-09 16:39 stufever
2011-08-09 16:53 ` Eric Dumazet
2011-08-09 17:52 ` Joe Perches
2011-08-09 17:59 ` Eric Dumazet
2011-08-09 18:12 ` Joe Perches
2011-08-09 18:24 ` Eric Dumazet
2011-08-09 19:57 ` Joe Perches
2011-08-10 2:20 ` Wang Shaoyan
2011-08-10 2:29 stufever
2011-08-10 2:28 ` Joe Perches
2011-08-10 3:50 ` Wang Shaoyan
2011-08-10 4:07 ` Joe Perches
2011-08-10 4:11 ` David Miller
2011-08-10 4:06 stufever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1312904624.2371.40.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC \
--to=eric.dumazet@gmail.com \
--cc=Sandeep.Kumar@freescale.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stufever@gmail.com \
--cc=wangshaoyan.pt@taobao.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).