Message ID | 20230202025716.216323-1-shahuang@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | [v2] selftests: KVM: Replace optarg with arg in guest_modes_cmdline | expand |
On Thu, 02 Feb 2023 10:57:15 +0800, shahuang@redhat.com wrote: > The parameter arg in guest_modes_cmdline not being used now, and the > optarg should be replaced with arg in guest_modes_cmdline. > > And this is the chance to change strtoul() to atoi_non_negative(), since > guest mode ID will never be negative. > > > [...] Applied to kvm-x86 selftests, thanks! [1/1] selftests: KVM: Replace optarg with arg in guest_modes_cmdline https://github.com/kvm-x86/linux/commit/62f86202d76d -- https://github.com/kvm-x86/linux/tree/next https://github.com/kvm-x86/linux/tree/fixes
On Wed, Feb 08, 2023, Sean Christopherson wrote: > On Thu, 02 Feb 2023 10:57:15 +0800, shahuang@redhat.com wrote: > > The parameter arg in guest_modes_cmdline not being used now, and the > > optarg should be replaced with arg in guest_modes_cmdline. > > > > And this is the chance to change strtoul() to atoi_non_negative(), since > > guest mode ID will never be negative. > > > > > > [...] > > Applied to kvm-x86 selftests, thanks! > > [1/1] selftests: KVM: Replace optarg with arg in guest_modes_cmdline > https://github.com/kvm-x86/linux/commit/62f86202d76d I force pushed to selftests because of a goof on my end, new SHA-1 is: https://github.com/kvm-x86/linux/commit/7ae69d7087a9
diff --git a/tools/testing/selftests/kvm/lib/guest_modes.c b/tools/testing/selftests/kvm/lib/guest_modes.c index 99a575bbbc52..1df3ce4b16fd 100644 --- a/tools/testing/selftests/kvm/lib/guest_modes.c +++ b/tools/testing/selftests/kvm/lib/guest_modes.c @@ -127,7 +127,7 @@ void guest_modes_cmdline(const char *arg) mode_selected = true; } - mode = strtoul(optarg, NULL, 10); + mode = atoi_non_negative("Guest mode ID", arg); TEST_ASSERT(mode < NUM_VM_MODES, "Guest mode ID %d too big", mode); guest_modes[mode].enabled = true; }