From: Dongsheng Yang Date: Wed, 3 Jun 2015 09:27:03 +0000 (+0800) Subject: btrfs-progs: qgroup limit: error out if input value is negative X-Git-Tag: upstream/4.16.1~2213 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9fd7cc0f554b88a8c878a36ed096347c98bba7f;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: qgroup limit: error out if input value is negative If we pass a negative value to command qgroup limit, btrfs-progs would convert it to unsigned long long silently. That's a little confusing to user, why I can limit my quota to a negative value. This patch add a check in parse_limit, if the input value is negative, error out to user. Reported-by: Tsutomu Itoh Signed-off-by: Dongsheng Yang Signed-off-by: David Sterba --- diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 00cc089..5ea4021 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -116,6 +116,10 @@ static int parse_limit(const char *p, unsigned long long *s) *s = CLEAR_VALUE; return 1; } + + if (p[0] == '-') + return 0; + size = strtoull(p, &endptr, 10); switch (*endptr) { case 'T':