lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Aug 2010 10:49:51 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Tobias Klauser <tklauser@...tanz.ch>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] slip: Use net_device_stats from struct net_device

Le jeudi 19 août 2010 à 10:25 +0200, Tobias Klauser a écrit :
> Use net_device->stats for stats instead of private variable copies in
> struct slip.
> 
> Signed-off-by: Tobias Klauser <tklauser@...tanz.ch>
> ---
>  drivers/net/slip.c |   64 ++++++++++++++++++++++------------------------------
>  drivers/net/slip.h |    9 -------
>  2 files changed, 27 insertions(+), 46 deletions(-)


> @@ -561,36 +562,25 @@ static int sl_change_mtu(struct net_device *dev, int new_mtu)
>  static struct net_device_stats *
>  sl_get_stats(struct net_device *dev)
>  {
> -	static struct net_device_stats stats;
> +	struct net_device_stats *stats = &dev->stats;
>  	struct slip *sl = netdev_priv(dev);
>  #ifdef SL_INCLUDE_CSLIP
>  	struct slcompress *comp;
>  #endif
>  
> -	memset(&stats, 0, sizeof(struct net_device_stats));
> -
> -	stats.rx_packets     = sl->rx_packets;
> -	stats.tx_packets     = sl->tx_packets;
> -	stats.rx_bytes	     = sl->rx_bytes;
> -	stats.tx_bytes	     = sl->tx_bytes;
> -	stats.rx_dropped     = sl->rx_dropped;
> -	stats.tx_dropped     = sl->tx_dropped;
> -	stats.tx_errors      = sl->tx_errors;
> -	stats.rx_errors      = sl->rx_errors;
> -	stats.rx_over_errors = sl->rx_over_errors;
>  #ifdef SL_INCLUDE_CSLIP
> -	stats.rx_fifo_errors = sl->rx_compressed;
> -	stats.tx_fifo_errors = sl->tx_compressed;
> -	stats.collisions     = sl->tx_misses;
> +	stats->rx_fifo_errors = sl->rx_compressed;
> +	stats->tx_fifo_errors = sl->tx_compressed;
> +	stats->collisions     = sl->tx_misses;
>  	comp = sl->slcomp;
>  	if (comp) {
> -		stats.rx_fifo_errors += comp->sls_i_compressed;
> -		stats.rx_dropped     += comp->sls_i_tossed;
> -		stats.tx_fifo_errors += comp->sls_o_compressed;
> -		stats.collisions     += comp->sls_o_misses;
> +		stats->rx_fifo_errors += comp->sls_i_compressed;
> +		stats->rx_dropped     += comp->sls_i_tossed;
> +		stats->tx_fifo_errors += comp->sls_o_compressed;
> +		stats->collisions     += comp->sls_o_misses;
>  	}
> -#endif /* CONFIG_INET */
> -	return (&stats);
> +#endif
> +	return stats;
>  }
>  

Hmm, this is wrong.

Each time sl_get_stats() is called, you are adding stuff to dev->stats

Quite frankly I dont think its a kernel-janitors@...r.kernel.org patch,
its pretty normal netdev stuff.

Please take a look at prior patch posted yesterday.

http://marc.info/?l=linux-netdev&m=128213719605250&w=2

Because either you should build your patch on top of it, or ask David to
revert mine before ;)

I advise using a ndo_get_stats64() so that you can perform the adds on a
private destination buffer.

Thanks


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists