All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2 v2] binfmt_misc: add comments & debug logs
Date: Mon, 20 Oct 2014 19:54:14 -0400	[thread overview]
Message-ID: <20141020235414.GA23349@vapier> (raw)
In-Reply-To: <1413845996.5407.2.camel@perches.com>

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

On 20 Oct 2014 15:59, Joe Perches wrote:
> On Mon, 2014-10-20 at 18:45 -0400, Mike Frysinger wrote:
> > diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> []
> > @@ -323,46 +343,113 @@ static Node *create_entry(const char __user *buffer, size_t count)
> []
> > +			if (e->mask) {
> > +				int i;
> > +				char *masked = kmalloc(e->size, GFP_USER);
> 
> Why GFP_USER?  Does it need it?

mostly a copy & paste from earlier in this func:
	e = kmalloc(memsize, GFP_USER);

the code is running process context and this buffer is only for
debugging on behalf of the user (and is shortly freed there after), so
GFP_USER seemed appropriate.  that said, i'm certainly not an expert
here, so if the convention is to use GFP_KERNEL, it's easy enough to
change.  the kmalloc API doesn't seem to provide guidance.

> >  	switch (res) {
> > -		case 1: clear_bit(Enabled, &e->flags);
> > +		case 1:
> > +			/* Disable this handler. */
> > +			clear_bit(Enabled, &e->flags);
> >  			break;
> > -		case 2: set_bit(Enabled, &e->flags);
> > +		case 2:
> > +			/* Enable this handler. */
> > +			set_bit(Enabled, &e->flags);
> >  			break;
> > -		case 3: root = dget(file->f_path.dentry->d_sb->s_root);
> > +		case 3:
> > +			/* Delete this handler. */
> > +			root = dget(file->f_path.dentry->d_sb->s_root);
> >  			mutex_lock(&root->d_inode->i_mutex);
> >  
> >  			kill_node(e);
> 
> Maybe move the case indents one tab position left

style fixes (for the whole file) are in the 2nd patch.  i specifically
tried to keep those changes to a minimum in this patch (functionality
vs formatting).
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-10-20 23:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-19 23:03 [PATCH 1/2] binfmt_misc: add comments & debug logs Mike Frysinger
2014-10-19 23:03 ` [PATCH 2/2] binfmt_misc: clean up code style a bit Mike Frysinger
2014-10-20  0:41 ` [PATCH 1/2] binfmt_misc: add comments & debug logs Joe Perches
2014-10-20 22:37   ` Mike Frysinger
2014-10-20 22:45 ` [PATCH 1/2 v2] " Mike Frysinger
2014-10-20 22:46   ` [PATCH 2/2 v2] binfmt_misc: clean up code style a bit Mike Frysinger
2014-10-20 22:59   ` [PATCH 1/2 v2] binfmt_misc: add comments & debug logs Joe Perches
2014-10-20 23:54     ` Mike Frysinger [this message]
2014-10-28 22:58       ` Andrew Morton
2014-10-28 23:25         ` Mike Frysinger

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=20141020235414.GA23349@vapier \
    --to=vapier@gentoo.org \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.