The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Rosenberg <drosenberg@vsecurity.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vsprintf: Neaten %pK kptr_restrict, save a bit of code space
Date: Wed, 19 Jan 2011 15:11:02 -0800	[thread overview]
Message-ID: <1295478662.1952.45.camel@Joe-Laptop> (raw)
In-Reply-To: <20110119145024.353ef8a1.akpm@linux-foundation.org>

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. ;)


  reply	other threads:[~2011-01-19 23:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 20:21 [PATCH] vsprintf: Neaten %pK kptr_restrict, save a bit of code space Joe Perches
2011-01-19 22:50 ` Andrew Morton
2011-01-19 23:11   ` Joe Perches [this message]
2011-01-19 23:16     ` Andrew Morton
2011-01-19 23:32       ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295478662.1952.45.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=drosenberg@vsecurity.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox