[Labeled-nfs] [PATCH 09/13] NFS: Client implementation of SELINUX Labeling

James Morris jmorris at namei.org
Mon Nov 19 06:44:56 EST 2007


On Fri, 16 Nov 2007, David P. Quigley wrote:

> +#ifdef CONFIG_NFS_V4_SECURITY_LABEL
> +	if (attr.ia_label != NULL)
> +		kfree(attr.ia_label);
> +#endif

Will it be typical for ia_label to be non-NULL ?  If so, you can leave out 
the NULL check, as kfree() does that via unlikely().  i.e. only check for 
NULL if you think it is likely (>90%) that it will be NULL.

Generally, you'll likely need to remove all of the #ifdefs from the core 
code, and use static inlines or normal functions instead (to be compiled 
away when not required).

> +	sattr.ia_label = (char *)buf;

No need to cast void pointers.



-- 
James Morris
<jmorris at namei.org>


More information about the Labeled-nfs mailing list