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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1314319088.19476.17.camel@Joe-Laptop>
Date:	Thu, 25 Aug 2011 17:38:08 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm: Neaten warn_alloc_failed

On Thu, 2011-08-25 at 17:05 -0700, Andrew Morton wrote:
> On Thu, 25 Aug 2011 17:00:01 -0700
> Joe Perches <joe@...ches.com> wrote:
> > On Thu, 2011-08-25 at 16:50 -0700, Andrew Morton wrote:
> > > On Thu, 25 Aug 2011 13:26:19 -0700
> > > Joe Perches <joe@...ches.com> wrote:
> > > > Add __attribute__((format (printf...) to the function
> > > > to validate format and arguments.  Use vsprintf extension
> > > > %pV to avoid any possible message interleaving. Coalesce
> > > > format string.  Convert printks/pr_warning to pr_warn.
> > []
> > > > -extern void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
> > > > +extern __attribute__((format (printf, 3, 4)))
> > > > +void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
> > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > looky:
> > Looky what?
> > There are _far_ more uses of __attribute__((format...)
> > than __printf(...)
> > I generally go with what's more commonly used,
> > especially when it's 206 to 8, and 1 of the
> > 8 is the #define itself.
> > $ grep -rP --include=*.[ch] "__attribute__.*format" * | wc -l
> > 206
> > $ grep -rP --include=*.[ch]  -w "__printf" * | wc -l
> > 8
> So?

So if you really like it that much:

grep -rPl --include=*.[ch] -w "__attribute__" * |
grep -v "^tools" | grep -v "^scripts" | grep -v "include/linux/compiler-gcc.h" |
xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

Then they're all the same.

cheers, Joe

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