netdev
[Top] [All Lists]

Re: [PATCH] reduce stack usage in ixgb_ethtool_ioctl

To: Denis Vlasenko <vda@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] reduce stack usage in ixgb_ethtool_ioctl
From: Dave Dillow <dave@xxxxxxxxxxxxxx>
Date: Sun, 19 Sep 2004 14:24:43 -0400
Cc: Jeff Garzik <jgarzik@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <200409192033.56716.vda@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <200409192033.56716.vda@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Sun, 2004-09-19 at 13:33, Denis Vlasenko wrote:
> Stack usage is still high because gcc will
> allocate too much space for these cases:
> 
>         case ETHTOOL_GSET:{
>                         struct ethtool_cmd ecmd = { ETHTOOL_GSET };
>                         ixgb_ethtool_gset(adapter, &ecmd);
>                         if (copy_to_user(addr, &ecmd, sizeof(ecmd)))
>                                 return -EFAULT;
>                         return 0;
>                 }
>         case ETHTOOL_SSET:{
>                         struct ethtool_cmd ecmd;
>                         if (copy_from_user(&ecmd, addr, sizeof(ecmd)))
>                                 return -EFAULT;
>                         return ixgb_ethtool_sset(adapter, &ecmd);
>                 }
> 
> There will be space for _two_ ecmd's on stack.
> 
> Shall it be worked around with ugly union of structs
> or we'll just wait for better gcc?

You could convert it to use ethtool_ops.
-- 
Dave Dillow <dave@xxxxxxxxxxxxxx>


<Prev in Thread] Current Thread [Next in Thread>