mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-12-05 01:54:19 +08:00
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 <t-itoh@jp.fujitsu.com> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
ea496435d5
commit
d9fd7cc0f5
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user