Commit 902c68a4 authored by Gui Hecheng's avatar Gui Hecheng Committed by Chris Mason

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: default avatarGui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent b05fd874
...@@ -1593,7 +1593,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, ...@@ -1593,7 +1593,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
new_size = old_size - new_size; new_size = old_size - new_size;
} else if (mod > 0) { } else if (mod > 0) {
if (new_size > ULLONG_MAX - old_size) { if (new_size > ULLONG_MAX - old_size) {
ret = -EINVAL; ret = -ERANGE;
goto out_free; goto out_free;
} }
new_size = old_size + new_size; new_size = old_size + new_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment