On Sat, Sep 24, 2022 at 06:56:49PM +0100, Al Viro wrote: > On Thu, Sep 22, 2022 at 05:17:04PM +0200, Christian Brauner wrote: > > > -static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name) > > +static int v9fs_fid_get_acl(struct p9_fid *fid, const char *name, > > + struct posix_acl **kacl) > > { > > ssize_t size; > > void *value = NULL; > > struct posix_acl *acl = NULL; > > > > size = v9fs_fid_xattr_get(fid, name, NULL, 0); > > - if (size > 0) { > > - value = kzalloc(size, GFP_NOFS); > > - if (!value) > > - return ERR_PTR(-ENOMEM); > > - size = v9fs_fid_xattr_get(fid, name, value, size); > > - if (size > 0) { > > - acl = posix_acl_from_xattr(&init_user_ns, value, size); > > - if (IS_ERR(acl)) > > - goto err_out; > > - } > > - } else if (size == -ENODATA || size == 0 || > > - size == -ENOSYS || size == -EOPNOTSUPP) { > > - acl = NULL; > > - } else > > - acl = ERR_PTR(-EIO); > > + if (size <= 0) > > + goto out; > > > > -err_out: > > + /* just return the size */ > > + if (!kacl) > > + goto out; > > How can that happen? Both callers are passing addresses of local variables > as the third argument. And what's the point of that kacl thing, anyway? > Same callers would be much happier if you returned acl or ERR_PTR()... Yeah, my bad. I had an initial draft just to get something to test where I returned it through an return argument instead of the function. Seems I missed to fix that spot. Thanks, fixed and also massaged the callers a bit.