OSDN Git Service

exportfs: fix 'passing zero to ERR_PTR()' warning
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / fs / xattr.c
index 9b932b9..09441c3 100644 (file)
@@ -163,7 +163,7 @@ xattr_getsecurity(struct inode *inode, const char *name, void *value,
        }
        memcpy(value, buffer, len);
 out:
-       security_release_secctx(buffer, len);
+       kfree(buffer);
 out_noalloc:
        return len;
 }
@@ -442,7 +442,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
                        size = XATTR_SIZE_MAX;
                kvalue = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
                if (!kvalue) {
-                       vvalue = vmalloc(size);
+                       vvalue = vzalloc(size);
                        if (!vvalue)
                                return -ENOMEM;
                        kvalue = vvalue;
@@ -453,7 +453,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
        if (error > 0) {
                if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
                    (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
-                       posix_acl_fix_xattr_to_user(kvalue, size);
+                       posix_acl_fix_xattr_to_user(kvalue, error);
                if (size && copy_to_user(value, kvalue, error))
                        error = -EFAULT;
        } else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {