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: <ZuNh6alWd1U1ZQLY@mini-arch>
Date: Thu, 12 Sep 2024 14:49:29 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: Stanislav Fomichev <sdf@...ichev.me>, netdev@...r.kernel.org,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com
Subject: Re: [PATCH net-next 05/13] selftests: ncdevmem: Unify error handling

On 09/12, Mina Almasry wrote:
> On Thu, Sep 12, 2024 at 10:13 AM Stanislav Fomichev <sdf@...ichev.me> wrote:
> >
> > There is a bunch of places where error() calls look out of place.
> > Use the same error(1, errno, ...) pattern everywhere.
> >
> > Cc: Mina Almasry <almasrymina@...gle.com>
> > Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
> > ---
> >  tools/testing/selftests/net/ncdevmem.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c
> > index a20f40adfde8..c0da2b2e077f 100644
> > --- a/tools/testing/selftests/net/ncdevmem.c
> > +++ b/tools/testing/selftests/net/ncdevmem.c
> > @@ -332,32 +332,32 @@ int do_server(struct memory_buffer *mem)
> >
> >         ret = inet_pton(server_sin.sin_family, server_ip, &server_sin.sin_addr);
> >         if (socket < 0)
> > -               error(79, 0, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> > +               error(1, 0, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> >
> >         socket_fd = socket(server_sin.sin_family, SOCK_STREAM, 0);
> >         if (socket < 0)
> > -               error(errno, errno, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> > +               error(1, errno, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> >
> 
> To be honest this was a bit intentional. For example here, I want to
> see what errno socket() failed with; it's a clue to why it failed.
> 
> I guess you're not actually removing that, right? You're making the
> return code of ncdevmem 1, but it will still print the errno of the
> subfailure? That sounds fine.
> 
> Isn't it a bit more standard for the sub errno to be the return of the
> parent process. But not opposed. If you think this is better we can go
> for it.

Yes, this will still print the correct errno.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ