Re: [PATCH v2 06/25] capability: provide helpers for converting between xattrs and vfs_caps

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

 



On Fri, Mar 01, 2024 at 05:30:55PM +0100, Roberto Sassu wrote:
> > +/*
> > + * Inner implementation of vfs_caps_to_xattr() which does not return an
> > + * error if the rootid does not map into @dest_userns.
> > + */
> > +static ssize_t __vfs_caps_to_xattr(struct mnt_idmap *idmap,
> > +				   struct user_namespace *dest_userns,
> > +				   const struct vfs_caps *vfs_caps,
> > +				   void *data, size_t size)
> > +{
> > +	struct vfs_ns_cap_data *ns_caps = data;
> > +	struct vfs_cap_data *caps = (struct vfs_cap_data *)ns_caps;
> > +	kuid_t rootkuid;
> > +	uid_t rootid;
> > +
> > +	memset(ns_caps, 0, size);
> 
> size -> sizeof(*ns_caps) (or an equivalent change)

This is zeroing out the passed buffer, so it should use the size passed
for the buffer. sizeof(*ns_caps) could potentially be more than the size
of the buffer.

Maybe it would be clearer if it was memset(data, 0, size)?

> I was zeroing more (the size of the buffer passed to vfs_getxattr()).
> 
> Roberto




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

  Powered by Linux