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  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, 15 Apr 2019 16:12:01 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Johan Hovold <johan@...nel.org>,
        Madhumitha Prabakaran <madhumithabiw@...il.com>,
        devel@...verdev.osuosl.org, elder@...nel.org,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        greybus-dev@...ts.linaro.org
Subject: Re: [PATCH] Staging: greybus: Cleanup in header file control.h

On Mon, Apr 15, 2019 at 04:33:57PM +0300, Dan Carpenter wrote:
> On Mon, Apr 15, 2019 at 03:10:02PM +0200, Johan Hovold wrote:
> > On Fri, Apr 05, 2019 at 03:14:37PM -0500, Madhumitha Prabakaran wrote:
> > > Fix a blank line after function/struct/union/enum
> > > declarations. Also, convert to_gb_control()  macro into an inline
> > > function in order to maintain Linux kernel coding style based
> > > on which the inline function is preferable over the macro.
> > 
> > There are about 1200 macros wrapping container_of() in the kernel, so
> > this is a common pattern which does not need to be changed (by contrast,
> > only a handful container_of are wrapped by functions).
> > 
> 
> A handful?
> 
> $ git grep "return container_of" | wc -l
> 1856
> 
> I'm like Donald Trump because I must have really small hands compared
> to the rest of y'all.

Heh, you're right, my grep-fu failed me.

Ok, so both styles are roughly as common (and a non-trivial portion of
those 1800 also are not simple wrappers).

> I would prefer to apply these sorts of patches unless it causes an
> issue...  Functions *are* better than macros.  It's a minor improvement,
> but this is staging and we make tons minor style changes.  It's part of
> the blessing and curse of being in staging...

While I agree functions are generally preferred, container_of() is
special as it includes type checking.

And again, using container_of() like this is a common pattern in the
kernel.

Johan

Powered by blists - more mailing lists