[RFC] [NET] libertas: fix ethtool -S

Dan Williams dcbw at redhat.com
Wed Mar 5 13:13:19 EST 2008


On Wed, 2008-03-05 at 11:28 +0100, Sebastian Siewior wrote:
> First of all we memset the memory incase of an error in order not leak
> anything to the user space. Using kzalloc in first place might be another
> sollution.
> And then I tried to put the correct request to the hardware what got
> broken in 301eacbf30e33f461701df91cb250d3fc24c5fe5
> 
> Signed-off-by: Sebastian Siewior <bigeasy at linutronix.de>
> ---
>  drivers/net/wireless/libertas/ethtool.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
> index 21e6f98..b204d71 100644
> --- a/drivers/net/wireless/libertas/ethtool.c
> +++ b/drivers/net/wireless/libertas/ethtool.c
> @@ -116,12 +116,11 @@ static void lbs_ethtool_get_stats(struct net_device * dev,
>  	lbs_deb_enter(LBS_DEB_ETHTOOL);
>  
>  	/* Get Mesh Statistics */
> -	ret = lbs_prepare_and_send_command(priv,
> -			CMD_MESH_ACCESS, CMD_ACT_MESH_GET_STATS,
> -			CMD_OPTION_WAITFORRSP, 0, &mesh_access);
> -
> -	if (ret)
> +	ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access);
> +	if (ret) {
> +		memset(data, 0, 8 * sizeof(u64));
>  		return;
> +	}
>  
>  	priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
>  	priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);

Anything having to do with mesh should probably be protected by if
(priv->mesh_dev) or whatever it is.  If there's no mesh-enabled
firmware, there's no way this call can possibly work :)

Dan





More information about the libertas-dev mailing list