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]
Date:	Wed, 10 Oct 2007 13:17:50 -0300
From:	Mauro Carvalho Chehab <mchehab@...radead.org>
To:	Alan Cox <alan@...hat.com>
Cc:	Michael Krufky <mkrufky@...uxtv.org>, video4linux-list@...hat.com,
	Jiri Slaby <jirislaby@...il.com>, daniel@...u.de,
	linux-kernel@...r.kernel.org, holger@...u.de,
	v4l-dvb maintainer list <v4l-dvb-maintainer@...uxtv.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [v4l-dvb-maintainer] [PATCH 3/3] V4L: cinergyT2, remove bad
	usage of ERESTARTSYS


Em Qua, 2007-10-10 às 11:59 -0400, Alan Cox escreveu:
> On Wed, Oct 10, 2007 at 12:35:41PM -0300, Mauro Carvalho Chehab wrote:
> > Em Qua, 2007-10-10 às 00:18 -0400, Michael Krufky escreveu:
> > > 
> > > Is this illegal as per kernel codingstyle?
> > 
> > Yes, it is. CodingStyle states:
> 
> <rant>
> No.. "Illegal" means prohibited by law. Its merely wrong 8)
> </rant>

LOL

> > The proper fix is just to replace the offended code by this:
> > 
> > err=foo();
> > if (error)
> > 	goto error;
> 
> Lots of code uses
> 
> 	if ((err = foo()) < 0)
> 
> so I would'y worry too much. The split one however clearer and also
> safer.

Yes, this is not a severe CodingStyle violation. Still, the above code
is better than the used one.

Since, on your example, it is clear that the programmer wanted to test
if the value is less than zero. 

The code:

	if ( (err=foo()) )

should also indicate an operator mistake of using =, instead of ==.

Probably, source code analyzers like Coverity will complain about the
above.

If not violating CodingStyle, I would rather prefer to code this as:
	if ( !(err=foo() ) 
or, even better, using:
	if ( (err=foo()) != 0)

clearly indicating that it is tested if the value is not zero.

Even being a quite simple issue, I would prefer if Jiri can fix it.

-- 
Cheers,
Mauro

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ