summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ioctl32.c
diff options
context:
space:
mode:
authorFrom: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2014-05-05 17:30:20 +1000
committerDave Chinner <david@fromorbit.com>2014-05-05 17:30:20 +1000
commitb28fd7b5fe232d7643d7c0595938e998ceb58508 (patch)
tree13ecd856c65c33998ba458f54d0bf5674630e904 /fs/xfs/xfs_ioctl32.c
parent3c353375761d81abfb66eb054aacceef31658e24 (diff)
downloadop-kernel-dev-b28fd7b5fe232d7643d7c0595938e998ceb58508.zip
op-kernel-dev-b28fd7b5fe232d7643d7c0595938e998ceb58508.tar.gz
xfs: Fix wrong error codes being returned
xfs_{compat_,}attrmulti_by_handle could return an errno with incorrect sign in some cases. While at it, make sure ENOMEM is returned instead of E2BIG if kmalloc fails. Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_ioctl32.c')
-rw-r--r--fs/xfs/xfs_ioctl32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index a7992f8..944d5ba 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -424,10 +424,11 @@ xfs_compat_attrmulti_by_handle(
ops = memdup_user(compat_ptr(am_hreq.ops), size);
if (IS_ERR(ops)) {
- error = PTR_ERR(ops);
+ error = -PTR_ERR(ops);
goto out_dput;
}
+ error = ENOMEM;
attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL);
if (!attr_name)
goto out_kfree_ops;
@@ -438,7 +439,7 @@ xfs_compat_attrmulti_by_handle(
compat_ptr(ops[i].am_attrname),
MAXNAMELEN);
if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
- error = -ERANGE;
+ error = ERANGE;
if (ops[i].am_error < 0)
break;
OpenPOWER on IntegriCloud