Re: [Labeled-nfs] [PATCH 08/13] NFS: Introduce lifecycle managment for label attribute.

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

 



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


> +#ifdef CONFIG_SECURITY
> +#define	nfs_fattr_alloc(fattr)						\
> +{									\
> +	(fattr)->label = kmalloc(NFS_MAXLABELLEN, GFP_ATOMIC);		\
> +	(fattr)->label_len = NFS_MAXLABELLEN;				\
> +	memset((fattr)->label, 0, NFS_MAXLABELLEN);			\
> +}

These should be normal functions, perhaps in their own file which is 
conditionally built (and containing other label-specific code).

You need to check the return of kmalloc().

I suggest passing a gfp_t parameter to the allocation function to allow 
the caller to determine the allocation flags (unless you know it will 
always be GFP_ATOMIC).

Use kzalloc() instead of kmalloc() + memset().

It seems wasteful to always allocate the maximum sized label.

-- 
James Morris
<jmorris@xxxxxxxxx>

--
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