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]
Message-ID: <ZOEOS5Qf4o2xw1Gj@vergenet.net>
Date: Sat, 19 Aug 2023 20:47:39 +0200
From: Simon Horman <horms@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	"Michael S . Tsirkin" <mst@...hat.com>,
	Jason Wang <jasowang@...hat.com>,
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, netdev@...r.kernel.org,
	eric.dumazet@...il.com
Subject: Re: [PATCH net-next 3/3] net: l2tp_eth: use generic dev->stats fields

On Sat, Aug 19, 2023 at 04:40:59AM +0000, Eric Dumazet wrote:
> Core networking has opt-in atomic variant of dev->stats,
> simply use DEV_STATS_INC(), DEV_STATS_ADD() and DEV_STATS_READ().
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---
>  net/l2tp/l2tp_eth.c | 32 ++++++++++++--------------------
>  1 file changed, 12 insertions(+), 20 deletions(-)
> 
> diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c

...

> @@ -146,10 +138,10 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb,
>  
>  	priv = netdev_priv(dev);
>  	if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) {
> -		atomic_long_inc(&priv->rx_packets);
> -		atomic_long_add(data_len, &priv->rx_bytes);
> +		DEV_STATS_INC(dev, rx_packets);
> +		DEV_STATS_ADD(dev, rx_bytes, data_len);

Hi Eric,

W=1 builds with clang-16 and gcc-13 tell me that priv
is set but unused if this branch is taken.

>  	} else {
> -		atomic_long_inc(&priv->rx_errors);
> +		DEV_STATS_INC(dev, rx_errors);
>  	}
>  	rcu_read_unlock();
>  
> -- 
> 2.42.0.rc1.204.g551eb34607-goog
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ