Re: [PATCH 2/4] SELinux: standardize return code handling in selinuxfs.c

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

 



On Wed, 2010-08-04 at 15:55 -0400, Stephen Smalley wrote:
> On Tue, 2010-08-03 at 14:31 -0400, Eric Paris wrote:
> > selinuxfs.c has lots of different standards on how to handle return paths on
> > error.  For the most part transition to
> > 
> > 	rc=errno
> > 	if (failure)
> > 		goto out;
> > [...]
> > out:
> > 	cleanup()
> > 	return rc;
> > 
> > Instead of doing cleanup mid function, or having multiple returns or other
> > options.  This doesn't do that for every function, but most of the complex
> > functions which have cleanup routines on error.
> > 
> > Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
> > ---
> > 
> >  security/selinux/selinuxfs.c |  652 ++++++++++++++++++++----------------------
> >  1 files changed, 317 insertions(+), 335 deletions(-)
> > 
> > diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> > index 402756c..3dcb841 100644
> > --- a/security/selinux/selinuxfs.c
> > +++ b/security/selinux/selinuxfs.c
> > @@ -177,7 +182,8 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
> >  	}
> >  	length = count;
> >  out:
> > -	free_page((unsigned long) page);
> > +	if (page)
> > +		free_page((unsigned long) page);
> >  	return length;
> 
> Isn't free_page(NULL) legal?

appears as though it is:

void free_pages(unsigned long addr, unsigned int order)
{
        if (addr != 0) {
                VM_BUG_ON(!virt_addr_valid((void *)addr));
                __free_pages(virt_to_page((void *)addr), order);
        }
}

Will resend.


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux