[PATCH] Btrfs-progs: fix arguments check of qgroup limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Segmentation fault occurred in the following command.

 # btrfs qgroup limit
 Segmentation fault

So, we should check a minimum number of arguments.

Signed-off-by: Tsutomu Itoh <t-itoh@xxxxxxxxxxxxxx>
---
 cmds-qgroup.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 15534ea..1525c11 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -374,6 +374,9 @@ static int cmd_qgroup_limit(int argc, char **argv)
 		}
 	}
 
+	if (check_argc_min(argc - optind, 2))
+		usage(cmd_qgroup_limit_usage);
+
 	if (!parse_limit(argv[optind], &size)) {
 		fprintf(stderr, "Invalid size argument given\n");
 		return 1;

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux