Commit c2c46b10 authored by Vipin Sharma's avatar Vipin Sharma Committed by Paolo Bonzini

KVM: selftests: Make reclaim_period_ms input always be positive

reclaim_period_ms used to be positive only but the commit 0001725d
("KVM: selftests: Add atoi_positive() and atoi_non_negative() for input
validation") incorrectly changed it to non-negative validation.

Change validation to allow only positive input.

Fixes: 0001725d ("KVM: selftests: Add atoi_positive() and atoi_non_negative() for input validation")
Signed-off-by: default avatarVipin Sharma <vipinsh@google.com>
Reported-by: default avatarBen Gardon <bgardon@google.com>
Reviewed-by: default avatarBen Gardon <bgardon@google.com>
Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
Message-Id: <20230111183408.104491-1-vipinsh@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent a44b3316
...@@ -241,7 +241,7 @@ int main(int argc, char **argv) ...@@ -241,7 +241,7 @@ int main(int argc, char **argv)
while ((opt = getopt(argc, argv, "hp:t:r")) != -1) { while ((opt = getopt(argc, argv, "hp:t:r")) != -1) {
switch (opt) { switch (opt) {
case 'p': case 'p':
reclaim_period_ms = atoi_non_negative("Reclaim period", optarg); reclaim_period_ms = atoi_positive("Reclaim period", optarg);
break; break;
case 't': case 't':
token = atoi_paranoid(optarg); token = atoi_paranoid(optarg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment