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] [day] [month] [year] [list]
Message-ID: <20251030182057.59731b84@kernel.org>
Date: Thu, 30 Oct 2025 18:20:57 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Adrian Moreno <amorenoz@...hat.com>
Cc: netdev@...r.kernel.org, nicolas.dichtel@...nd.com, toke@...hat.com,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
 <horms@...nel.org>, Kuniyuki Iwashima <kuniyu@...gle.com>, Stanislav
 Fomichev <sdf@...ichev.me>, Xiao Liang <shaw.leon@...il.com>, Cong Wang
 <cong.wang@...edance.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2] rtnetlink: honor RTEXT_FILTER_SKIP_STATS in
 IFLA_STATS

On Wed, 29 Oct 2025 09:01:52 +0100 Adrian Moreno wrote:
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -1275,8 +1275,9 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
>  	       + nla_total_size(IFALIASZ) /* IFLA_IFALIAS */
>  	       + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */
>  	       + nla_total_size_64bit(sizeof(struct rtnl_link_ifmap))
> -	       + nla_total_size(sizeof(struct rtnl_link_stats))
> -	       + nla_total_size_64bit(sizeof(struct rtnl_link_stats64))
> +	       + ((ext_filter_mask & RTEXT_FILTER_SKIP_STATS) ? 0 :
> +		  (nla_total_size(sizeof(struct rtnl_link_stats)) +
> +		   nla_total_size_64bit(sizeof(struct rtnl_link_stats64))))
>  	       + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */
>  	       + nla_total_size(MAX_ADDR_LEN) /* IFLA_BROADCAST */
>  	       + nla_total_size(4) /* IFLA_TXQLEN */

Forgive me but now I'm gonna nit pick ;)
Please break this out into a proper if condition.
It's quite hard to read.

	size_t size;

	size = NLMSG_ALIGN(sizeof(struct ifinfomsg))
		+ /* .. litany .. */

	if (!(ext_filter_mask & RTEXT_FILTER_SKIP_STATS))
		size += nla_total_size(sizeof(struct rtnl_link_stats)) +
			nla_total_size_64bit(sizeof(struct rtnl_link_stats64));

	return size;
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ