From: Gui Hecheng Date: Mon, 31 Mar 2014 10:03:25 +0000 (+0800) Subject: btrfs: filter invalid arg for btrfs resize X-Git-Tag: submit/tizen/20160607.132125~4568^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a40f1222a372de77344d85d31f8fe0e1c0e60e7;p=sdk%2Femulator%2Femulator-kernel.git btrfs: filter invalid arg for btrfs resize Originally following cmds will work: # btrfs fi resize -10A # btrfs fi resize -10Gaha Filter the arg by checking the return pointer of memparse. Signed-off-by: Gui Hecheng Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 59622366c613..05f8df866e4c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1472,6 +1472,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, struct btrfs_trans_handle *trans; struct btrfs_device *device = NULL; char *sizestr; + char *retptr; char *devstr = NULL; int ret = 0; int mod = 0; @@ -1539,8 +1540,8 @@ static noinline int btrfs_ioctl_resize(struct file *file, mod = 1; sizestr++; } - new_size = memparse(sizestr, NULL); - if (new_size == 0) { + new_size = memparse(sizestr, &retptr); + if (*retptr != '\0' || new_size == 0) { ret = -EINVAL; goto out_free; }