KVM: selftests: Make reclaim_period_ms input always be positive
PATCH 1/1 KVM: selftests: Make reclaim_period_ms input always be positive
reclaim_period_ms used 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.
--- tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c +1 -1
@@ -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);
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Quoted 9 lines · Vipin Sharma
reclaim_period_msused to be positive only but the commit0001725d0f9b("KVM: selftests: Addatoi_positive()andatoi_non_negative()for input validation") incorrectly changed it to non-negative validation.Change validation to allow only positive input.
Signed-off-by Vipin Sharma <[email protected]>Reported-by Ben Gardon <[email protected]>
Please add a Fixes: tag:
atoi_non_negative() for input validation")
But otherwise,
Quoted 20 lines
--- tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c +1
-2@@ -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
Quoted 7 lines · Ben Gardon
Quoted 5 lines · Vipin Sharma
reclaim_period_msused to be positive only but the commit0001725d0f9b("KVM: selftests: Addatoi_positive()andatoi_non_negative()for input validation") incorrectly changed it to non-negative validation.
Quoted 8 lines
Quoted 4 lines
Change validation to allow only positive input.
Signed-off-by Vipin Sharma <[email protected]>Reported-by Ben Gardon <[email protected]>Please add a Fixes: tag:
Fixes 0001725d0f9b ("KVM: selftests: Add atoi_positive() and
atoi_non_negative()for input validation")
Forgot this, I will send v2. Thanks.
Quoted 24 lines
But otherwise,
Reviewed-by Ben Gardon <[email protected]>Quoted 20 lines
--- tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c +1
-2@@ -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