From: Gui Hecheng Date: Thu, 29 May 2014 01:19:58 +0000 (+0800) Subject: btrfs: replace EINVAL with ERANGE for resize when ULLONG_MAX X-Git-Tag: firefly_0821_release~176^2~3585^2~58 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=902c68a4da74442f0ab1c0b458f7723a68dfd3b1;p=firefly-linux-kernel-4.4.55.git btrfs: replace EINVAL with ERANGE for resize when ULLONG_MAX 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 219e26fa9069..55f4d717d541 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -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;