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: <20250417175318.68220-1-kuniyu@amazon.com>
Date: Thu, 17 Apr 2025 10:53:15 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <pabeni@...hat.com>
CC: <davem@...emloft.net>, <dsahern@...nel.org>, <edumazet@...gle.com>,
	<horms@...nel.org>, <kuba@...nel.org>, <kuni1840@...il.com>,
	<kuniyu@...zon.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH RESEND v2 net-next 01/14] ipv6: Validate RTA_GATEWAY of RTA_MULTIPATH in rtm_to_fib6_config().

From: Paolo Abeni <pabeni@...hat.com>
Date: Wed, 16 Apr 2025 10:22:33 +0200
> > +static int rtm_to_fib6_multipath_config(struct fib6_config *cfg,
> > +					struct netlink_ext_ack *extack)
> > +{
> > +	struct rtnexthop *rtnh;
> > +	int remaining;
> > +
> > +	remaining = cfg->fc_mp_len;
> > +	rtnh = (struct rtnexthop *)cfg->fc_mp;
> > +
> > +	if (!rtnh_ok(rtnh, remaining)) {
> > +		NL_SET_ERR_MSG(extack, "Invalid nexthop configuration - no valid nexthops");
> > +		return -EINVAL;
> > +	}
> > +
> > +	do {
> 
> I think the initial checks and the loop could be rewritten reducing the
> indentation and calling the helper only once with something alike:
> 
> 	for (i = 0; rtnh_ok(rtnh, remaining);
> 	     i++, rtnh = rtnh_next(rtnh, &remaining)) {
> 		int attrlen = rtnh_attrlen(rtnh);
> 		if (!attrlen)
> 			continue;
> 		
> 		// ...
> 	}
> 	if (i == 0) {
> 		NL_SET_ERR_MSG(extack, "Invalid nexthop configuration - no valid
> nexthops");
> 		// ..
> 
> I guess it's a bit subjective, don't repost just for this.

I couldn't reduce the nest due to patch 4, so I'll keep this as is.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ