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:   Mon, 07 Jan 2019 14:50:30 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Joe Perches <joe@...ches.com>, Jason Gunthorpe <jgg@...pe.ca>,
        Gal Pressman <galpress@...zon.com>
Cc:     Stephen Warren <swarren@...dotorg.org>,
        Tariq Toukan <tariqt@...lanox.com>, xavier.huwei@...wei.com,
        netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
        Doug Ledford <dledford@...hat.com>,
        Stephen Warren <swarren@...dia.com>,
        Christoph Hellwig <hch@....de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] coding-style: Clarify the expectations around bool

On Mon, 2019-01-07 at 14:10 -0800, Joe Perches wrote:
> On Mon, 2019-01-07 at 14:11 -0700, Jason Gunthorpe wrote:
> > There has been some confusion since checkpatch started warning about bool
> > use in structures, and people have been avoiding using it.
> > 
> > Many people feel there is still a legitimate place for bool in structures,
> > so provide some guidance on bool usage derived from the entire thread that
> > spawned the checkpatch warning.
> 
> Thanks Jason.
> 
> It'd be nice to combine this with some better
> checkpatch warning or even a removal of that
> misleading warning from checkpatch altogether.
> 
> With a couple minor nits below and and Ack if
> you want one:
> 
> Acked-by: Joe Perches <joe@...ches.com>
> 
> > diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> 
> []
> > @@ -921,7 +921,37 @@ result.  Typical examples would be functions that return pointers; they use
> >  NULL or the ERR_PTR mechanism to report failure.
> >  
> >  
> > -17) Don't re-invent the kernel macros
> > +17) Using bool
> > +--------------
> > +
> > +The Linux kernel uses the C99 standard for the bool type. bool values can only
> 
> Maybe
> 
> The Linux kernel bool type is the C99 _Bool type.

Or maybe "The Linux kernel bool type is an alias for the C99 _Bool type."

> > +evaluate to 0 or 1, and implicit or explicit conversion to bool automatically
> > +converts the value to true or false. When using bool types the !! construction
> > +is not needed, which eliminates a class of bugs.
> > +
> > +When working with bool values the true and false labels should be used instead
> 
> true and false are not labels but #defines

With these refinements, feel free to add:

Reviewed-by: Bart Van Assche <bvanassche@....org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ