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: <b8feb625dd2ba0d0dfc298a2f39ca1d8368ba5c9.camel@perches.com>
Date:   Sun, 08 May 2022 13:51:55 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Vasily Averin <vvs@...nvz.org>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>, kernel@...nvz.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH mm] tracing: incorrect gfp_t conversion

On Sat, 2022-05-07 at 15:48 -0700, Andrew Morton wrote:
> On Sun, 8 May 2022 01:28:58 +0300 Vasily Averin <vvs@...nvz.org> wrote:
> 
> > On 5/7/22 22:37, Andrew Morton wrote:
> > > On Sat, 7 May 2022 22:02:05 +0300 Vasily Averin <vvs@...nvz.org> wrote:
> > > > +	{(__force unsigned long)GFP_KERNEL,		"GFP_KERNEL"},		\
> > > > +	{(__force unsigned long)GFP_NOFS,		"GFP_NOFS"},		\
> > > 
> > > This got all repetitive, line-wrappy and ugly :(
> > > 
> > > What do we think of something silly like this?
> > 
> > > --- a/include/trace/events/mmflags.h~tracing-incorrect-gfp_t-conversion-fix
> > > +++ a/include/trace/events/mmflags.h
> > > @@ -13,53 +13,57 @@
> > >   * Thus most bits set go first.
> > >   */
> > >  
> > > +#define FUL __force unsigned long
> > > +
> > >  #define __def_gfpflag_names						\
> > > -	{(__force unsigned long)GFP_TRANSHUGE,		"GFP_TRANSHUGE"},	\
> > > -	{(__force unsigned long)GFP_TRANSHUGE_LIGHT,	"GFP_TRANSHUGE_LIGHT"}, \
> > ...
> > > +	{(FUL)GFP_TRANSHUGE,		"GFP_TRANSHUGE"},	\
> > > +	{(FUL)GFP_TRANSHUGE_LIGHT,	"GFP_TRANSHUGE_LIGHT"}, \
> > 
> > 
> > I think it's a good idea, and I regret it was your idea and not mine.
> 
> heh
> 
> > Should I resend my patch with these changes or would you prefer 
> > to keep your patch as a separate one?
> 
> I did the below.  I'll squash them together later.

Very repetitive indeed.

Why not use another stringifying macro?

Maybe something like:

#define gfpflag_string(GFP)	\
	{(__force unsigned long)GFP, #GFP)}

#define __def_gfpflag_names			\
	gfp_flag_string(GFP_TRANSHUGE),		\
	etc...


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ