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: <20250417205741.13720-1-kuniyu@amazon.com>
Date: Thu, 17 Apr 2025 13:57:38 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kuniyu@...zon.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <horms@...nel.org>,
	<kuba@...nel.org>, <kuni1840@...il.com>, <netdev@...r.kernel.org>,
	<pabeni@...hat.com>
Subject: Re: [PATCH v1 net-next 1/7] neighbour: Make neigh_valid_get_req() return ndmsg.

From: Simon Horman <horms@...nel.org>
Date: Thu, 17 Apr 2025 13:53:10 +0100
> On Tue, Apr 15, 2025 at 05:41:24PM -0700, Kuniyuki Iwashima wrote:
> > neigh_get() passes 4 local variable pointers to neigh_valid_get_req().
> > 
> > If it returns a pointer of struct ndmsg, we do not need to pass two
> > of them.
> > 
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> 
> ...
> 
> > @@ -2893,17 +2892,19 @@ static int neigh_valid_get_req(const struct nlmsghdr *nlh,
> >  		case NDA_DST:
> >  			if (nla_len(tb[i]) != (int)(*tbl)->key_len) {
> >  				NL_SET_ERR_MSG(extack, "Invalid network address in neighbor get request");
> > -				return -EINVAL;
> 
> Hi Iwashima-san,
> 
> I think you need the following here:
> 
> 				err = -EINVAL;
> 
> > +				goto err;
> >  			}
> >  			*dst = nla_data(tb[i]);
> >  			break;
> >  		default:
> >  			NL_SET_ERR_MSG(extack, "Unsupported attribute in neighbor get request");
> > -			return -EINVAL;
> 
> And here.
> 
> Flagged by Smatch as:
> 
>   .../neighbour.c:2907 neigh_valid_get_req() warn: passing zero to 'ERR_PTR'
> 
> > +			goto err;

Thanks for catching!

I missed nlmsg_parse_deprecated_strict() reset err to 0.

I'll explicitly set err before goto in every path instead of
initialising it first.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ