[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230111183408.104491-1-vipinsh@google.com>
Date: Wed, 11 Jan 2023 10:34:08 -0800
From: Vipin Sharma <vipinsh@...gle.com>
To: seanjc@...gle.com, pbonzini@...hat.com, bgardon@...gle.com
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Vipin Sharma <vipinsh@...gle.com>
Subject: [Patch v2] KVM: selftests: Make reclaim_period_ms input always be positive
reclaim_period_ms use to be positive only but the commit 0001725d0f9b
("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: 0001725d0f9b ("KVM: selftests: Add atoi_positive() and atoi_non_negative() for input validation")
Signed-off-by: Vipin Sharma <vipinsh@...gle.com>
Reported-by: Ben Gardon <bgardon@...gle.com>
Reviewed-by: Ben Gardon <bgardon@...gle.com>
---
v2:
- Added Fixes and Reviewed-by tags
v1: https://lore.kernel.org/lkml/20230110215203.4144627-1-vipinsh@google.com/
tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c b/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c
index ea0978f22db8..251794f83719 100644
--- a/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c
+++ b/tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c
@@ -241,7 +241,7 @@ int main(int argc, char **argv)
while ((opt = getopt(argc, argv, "hp:t:r")) != -1) {
switch (opt) {
case 'p':
- reclaim_period_ms = atoi_non_negative("Reclaim period", optarg);
+ reclaim_period_ms = atoi_positive("Reclaim period", optarg);
break;
case 't':
token = atoi_paranoid(optarg);
--
2.39.0.314.g84b9a713c41-goog
Powered by blists - more mailing lists