path: root/cmds-qgroup.c
diff options
authorDongsheng Yang <>2015-06-03 17:27:03 +0800
committerDavid Sterba <>2015-06-05 18:40:32 +0200
commitd9fd7cc0f554b88a8c878a36ed096347c98bba7f (patch)
tree1222a9d0aa8b65ea0f7e833b38fe70021fbf857d /cmds-qgroup.c
parentea496435d5f9eb97681bcd69ff012917b2a3b201 (diff)
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 <>
Diffstat (limited to 'cmds-qgroup.c')
1 files changed, 4 insertions, 0 deletions
diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 00cc0894..5ea40216 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -116,6 +116,10 @@ static int parse_limit(const char *p, unsigned long long *s)
return 1;
+ if (p[0] == '-')
+ return 0;
size = strtoull(p, &endptr, 10);
switch (*endptr) {
case 'T':