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

Seth Forshee (DigitalOcean)
2024-02-22T15:38:06Z

On Thu, Feb 22, 2024 at 04:20:08PM +0100, Christian Brauner wrote:
> > + if ((magic_etc & VFS_CAP_REVISION_MASK) != VFS_CAP_REVISION_1) {
> > + vfs_caps->permitted.val += (u64)le32_to_cpu(caps->data[1].permitted) << 32;
> > + vfs_caps->inheritable.val += (u64)le32_to_cpu(caps->data[1].inheritable) << 32;
>
> That + makes this even more difficult to read. This should be rewritten.

Do you meant that you would prefer |= to +=, or do you have something
else in mind?

Note though that this is code that I didn't change, just moved.
Generally I tried to avoid changing code if it wasn't necessary for the
aims of this series.

> > +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 *caps = data;
> > + int ret;
>
> This should very likely be ssize_t ret.

Indeed, I'll fix that.