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, 1 Jul 2015 14:26:44 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Dan Carpenter <dan.carpenter@...cle.com>
cc:	Clemens Ladisch <clemens@...isch.de>,
	Joe Perches <joe@...ches.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: RFC: kernel coding style: prefer array to &array[0] ?



On Wed, 1 Jul 2015, Dan Carpenter wrote:

> On Wed, Jul 01, 2015 at 01:54:29PM +0200, Clemens Ladisch wrote:
> > Joe Perches wrote:
> > > It seems most in-kernel uses are 'array' rather than '&array[0]'
> > >
> > > Most of the time, using array is simpler to read than &array[0].
> > >
> > > Exceptions exists when addresses for consecutive members are
> > > used like func(&array[0], &array[1]);
> >
> > I use '&array[0]' when I want to get a pointer to a single object that
> > happens to be the first one in an array.
>
> Yeah.  Of course, you're right.  Otherwise it ends up confusing static
> checkers if you want the first element or the whole array.
>
> >
> > > Should this preference be put into checkpatch and/or CodingStyle?
> >
> > How about the following low-hanging fruit?
> >
> >   foo(..., &array[0], ARRAY_SIZE(array), ...)
>
> Yes, to this also.  I doubt checkpatch.pl will find a meaningful number
> of these but doing that is annoying thing.

Atcually, I find 236 of them, in 48 files.

julia
--
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