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: <20250623162833.GD506049@horms.kernel.org>
Date: Mon, 23 Jun 2025 17:28:33 +0100
From: Simon Horman <horms@...nel.org>
To: Wei Fang <wei.fang@....com>
Cc: Claudiu Manoil <claudiu.manoil@....com>,
	Vladimir Oltean <vladimir.oltean@....com>,
	Clark Wang <xiaoning.wang@....com>,
	"andrew+netdev@...n.ch" <andrew+netdev@...n.ch>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>,
	"pabeni@...hat.com" <pabeni@...hat.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: Re: [PATCH net-next 1/3] net: enetc: change the statistics of ring
 to unsigned long type

On Mon, Jun 23, 2025 at 01:49:59AM +0000, Wei Fang wrote:
> > >  struct enetc_ring_stats {
> > > -	unsigned int packets;
> > > -	unsigned int bytes;
> > > -	unsigned int rx_alloc_errs;
> > > -	unsigned int xdp_drops;
> > > -	unsigned int xdp_tx;
> > > -	unsigned int xdp_tx_drops;
> > > -	unsigned int xdp_redirect;
> > > -	unsigned int xdp_redirect_failures;
> > > -	unsigned int recycles;
> > > -	unsigned int recycle_failures;
> > > -	unsigned int win_drop;
> > > +	unsigned long packets;
> > > +	unsigned long bytes;
> > > +	unsigned long rx_alloc_errs;
> > > +	unsigned long xdp_drops;
> > > +	unsigned long xdp_tx;
> > > +	unsigned long xdp_tx_drops;
> > > +	unsigned long xdp_redirect;
> > > +	unsigned long xdp_redirect_failures;
> > > +	unsigned long recycles;
> > > +	unsigned long recycle_failures;
> > > +	unsigned long win_drop;
> > >  };
> > 
> > Hi Wei fang,
> > 
> > If the desire is for an unsigned 64 bit integer, then I think either u64 or unsigned
> > long long would be good choices.
> > 
> > unsigned long may be 64bit or 32bit depending on the platform.
> 
> The use of unsigned long is to keep it consistent with the statistical
> value type in struct net_device_stats. Because some statistics in
> net_device_stats come from enetc_ring_stats.
> 
> #define NET_DEV_STAT(FIELD)			\
> 	union {					\
> 		unsigned long FIELD;		\
> 		atomic_long_t __##FIELD;	\
> 	}

Thanks, I understand. But in this case I think the patch description could
be reworded - unsigned int and unsigned long are the same thing on some
systems, and on such systems there is no overflow advantage of one over the
other.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ