Re: [PATCH 3/9] VFS: Introduce a mount context

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

 



On Wed, 2017-05-03 at 14:13 -0400, Jeff Layton wrote:
> On Wed, 2017-05-03 at 17:04 +0100, David Howells wrote:
> > Introduce a mount context concept.

trivia:

> > static int selinux_mount_ctx_option(struct mount_context *mc, char *opt)
> > +{
[]
> > +	if (opts->mnt_opts) {
> > +		oo = kmalloc((opts->num_mnt_opts + 1) * sizeof(char *),
> > +			     GFP_KERNEL);
> > +		if (!oo)
> > +			return -ENOMEM;
> > +		memcpy(oo, opts->mnt_opts, opts->num_mnt_opts * sizeof(char *));
> > +		oo[opts->num_mnt_opts] = NULL;
> > +		old = opts->mnt_opts;
> > +		opts->mnt_opts = oo;
> > +		kfree(old);
> > +	}

krealloc would probably be more efficient and possible
readable as likely there's already padding in the original
allocation.

Are there no locking constraints?




[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