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, 24 Oct 2012 21:26:20 +1100
From:	Stephen Rothwell <sfr@...b.auug.org.au>
To:	Cyrill Gorcunov <gorcunov@...nvz.org>
Cc:	akpm@...ux-foundation.org, a.p.zijlstra@...llo.nl,
	xemul@...allels.com, LKML <linux-kernel@...r.kernel.org>
Subject: Re: + procfs-add-vmflags-field-in-smaps-output-v3-fix-2.patch added
 to -mm tree

Hi Cyrill,

On Wed, 24 Oct 2012 13:59:59 +0400 Cyrill Gorcunov <gorcunov@...nvz.org> wrote:
>
> On Wed, Oct 24, 2012 at 08:47:46PM +1100, Stephen Rothwell wrote:
> > 
> > On Wed, 24 Oct 2012 12:45:15 +0400 Cyrill Gorcunov <gorcunov@...nvz.org> wrote:
> > >
> > >  static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
> > >  {
> > > +#define __VM_FLAG(_f, _s)	[ilog2(_f)] = {(const char [2]){_s}}
> > 
> > I really don't think you need the cast (and it may hide bad usages) or
> > the second set of braces.  Thus:
> 
> Hi Stephen, could you please elaborate, which bad usage hiding could be there?

I though it might suppress a warning if someone added an entry with a >2
character string, but testing shows that it does not, so that is OK.
There is still no need for the cast, though, or the second set of
braces.  The C standard allows fixed length char arrays to be initialised
by string constants and discards the trailing NUL if necessary.

> > Further is there any reason for the struct?
> > 
> > #define __VM_FLAG(_f, _s)	[ilog2(_f)] = _s
> > 
> > static const char mnemonics[BITS_PER_LONG][2] = {
> > ...
> > };
> 
> Well, good point, though the benefit of using stucture here
> could be easier way for extension if needed. The compiled result
> is the same as for plain array or structure, so I would rather
> stick with struct here, until contrary proved (I mean it's not
> a problem to update the patch and use array here but I still
> think struct it better in long term). If you guys think that I
> should move it to array -- no problem, i may update ;)

One thing we learn about early (especially working at IBM) is to resist
the temptation to over engineer :-)

-- 
Cheers,
Stephen Rothwell                    sfr@...b.auug.org.au

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ