Skip to contentSkip to conversation

KVM: selftests: Make reclaim_period_ms input always be positive

PATCH In review Vipin Sharma 2 participants 5 messages Jan 11, 2023 – Feb 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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")

---

v2:
- Added Fixes and Reviewed-by tags

v1: https://lore.kernel.org/lkml/[email protected]/

 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
index ea0978f22db8..251794f83719 100644
@@ -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
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Vipin Sharma

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")

---

#2 lore raw
In reply to Vipin Sharma
Quoted 8 lines · Vipin Sharma

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.

[...]

Applied to kvm-x86 selftests, thanks!

[1/1] KVM: selftests: Make reclaim_period_ms input always be positive

      https://github.com/kvm-x86/linux/commit/4dfd8e37fa0f

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes

#3 lore raw
Quoted 6 lines · Sean Christopherson
Quoted 4 lines · Vipin Sharma

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.

Quoted 6 lines
Quoted 4 lines

Change validation to allow only positive input.

[...]

Applied to kvm-x86 selftests, thanks!

Just FYI, this patch has already been applied to kvm/master branch.
https://git.kernel.org/pub/scm/virt/kvm/kvm.git/commit/?id=c2c46b10d52624376322b01654095a84611c7e09

Quoted 7 lines

[1/1] KVM: selftests: Make reclaim_period_ms input always be positive

      https://github.com/kvm-x86/linux/commit/4dfd8e37fa0f

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes

#4 lore raw
Quoted 10 lines · Vipin Sharma
Quoted 9 lines · Sean Christopherson
Quoted 7 lines · Vipin Sharma

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

[...]

Applied to kvm-x86 selftests, thanks!

Just FYI, this patch has already been applied to kvm/master branch.
https://git.kernel.org/pub/scm/virt/kvm/kvm.git/commit/?id=c2c46b10d52624376322b01654095a84611c7e09

Now I know why I was getting deja vu... Dropped, thanks Vipin!