lkml.org 
[lkml]   [2011]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] vsprintf: Neaten %pK kptr_restrict, save a bit of code space
From
Date
On Wed, 2011-01-19 at 14:50 -0800, Andrew Morton wrote:
> On Thu, 13 Jan 2011 12:21:12 -0800
> Joe Perches <joe@perches.com> wrote:
> > If kptr restrictions are on, just set the passed pointer to NULL.
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
[]
> > + if (!((kptr_restrict == 0) ||
> > + (kptr_restrict == 1 &&
> > + has_capability_noaudit(current, CAP_SYSLOG))))
> > + ptr = NULL;
> > + break;
> This hurts my brain. Does it work?

Some say mentally challenging puzzles help deter/delay
onset of cognitive decline/Alzheimer's. See: www.dakim.com

A mentally less challenging perhaps cleaner form is:

if (kptr_restrict == 0)
break;
if (kptr_restrict == 1 &&
has_capability_noaudit(current, CAP_SYSLOG))
break;
ptr = NULL;
break;

Your choice. ;)



\
 
 \ /
  Last update: 2011-01-20 00:13    [W:0.247 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site