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: <e92131c3b6e04a848f2a7922719f4747@AcuMS.aculab.com>
Date:   Mon, 6 Aug 2018 16:41:17 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Andy Shevchenko' <andy.shevchenko@...il.com>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
CC:     "Lee, Chun-Yi" <jlee@...e.com>, Darren Hart <dvhart@...radead.org>,
        "Andy Shevchenko" <andy@...radead.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] platform/x86: acer-wmi: use true and false for boolean
 values

From: Andy Shevchenko
> Sent: 05 August 2018 11:26
> 
> On Sun, Aug 5, 2018 at 3:18 AM, Gustavo A. R. Silva
> <gustavo@...eddedor.com> wrote:
> > Return statements in functions returning bool should use true or false
> > instead of an integer value.
> >
> > This code was detected with the help of Coccinelle.
> 
> >  static bool has_cap(u32 cap)
> >  {
> >         if ((interface->capability & cap) != 0)
> > -               return 1;
> > +               return true;
> >
> > -       return 0;
> > +       return false;
> >  }
> 
> this entire function can be oneliner:
> 
> return !!(...);

Why the !! ?? Just:
	return (interface->capability & cap) != 0;

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ