diff options
author | Shaoqin Huang <shahuang@redhat.com> | 2023-02-02 03:57:15 +0100 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-02-08 15:38:47 +0100 |
commit | 7ae69d7087a9a4d014e11b5328a49091cc1682f8 (patch) | |
tree | addba7db8f8e7932f99363cbcdd5a1aaabccc848 /tools | |
parent | KVM: selftests: Assign guest page size in sync area early in memslot_perf_test (diff) | |
download | linux-7ae69d7087a9a4d014e11b5328a49091cc1682f8.tar.xz linux-7ae69d7087a9a4d014e11b5328a49091cc1682f8.zip |
selftests: KVM: Replace optarg with arg in guest_modes_cmdline
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.
Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
Fixes: e42ac777d661 ("KVM: selftests: Factor out guest mode code")
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Reviewed-by: Vipin Sharma <vipinsh@google.com>
Link: https://lore.kernel.org/r/20230202025716.216323-1-shahuang@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/kvm/lib/guest_modes.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |