btrfs: replace EINVAL with ERANGE for resize when ULLONG_MAX
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>
Thu, 29 May 2014 01:19:58 +0000 (09:19 +0800)
committerChris Mason <clm@fb.com>
Tue, 10 Jun 2014 00:21:07 +0000 (17:21 -0700)
To be accurate about the error case,
if the new size is beyond ULLONG_MAX, return ERANGE instead of EINVAL.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c

index 219e26fa90697b3f5f81c1cc85e2df0ec5d03fa2..55f4d717d541917e3efc03a7f95a6ed437b482bf 100644 (file)
@@ -1593,7 +1593,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
                new_size = old_size - new_size;
        } else if (mod > 0) {
                if (new_size > ULLONG_MAX - old_size) {
-                       ret = -EINVAL;
+                       ret = -ERANGE;
                        goto out_free;
                }
                new_size = old_size + new_size;
This page took 0.032261 seconds and 5 git commands to generate.