Re: [PATCH 1/2 v2] binfmt_misc: add comments & debug logs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux