All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaoqin Huang <shahuang@redhat.com>
To: Vipin Sharma <vipinsh@google.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests: KVM: Replace optarg with arg in guest_modes_cmdline
Date: Thu, 2 Feb 2023 10:38:19 +0800	[thread overview]
Message-ID: <4b847318-280f-8b9b-bafa-2ada86a54cfa@redhat.com> (raw)
In-Reply-To: <CAHVum0eH_XrrPiviYYWEu=FouhEXeWq1mcx0=BoiF8NaoyVj_g@mail.gmail.com>


On 2/2/23 00:00, Vipin Sharma wrote:
> On Tue, Jan 31, 2023 at 9:46 PM <shahuang@redhat.com> wrote:
>> From: Shaoqin Huang <shahuang@redhat.com>
>>
>> The parameter arg in guest_modes_cmdline not being used now, and the
>> optarg should be replaced with arg in guest_modes_cmdline.
>>
>> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
>> ---
>>   tools/testing/selftests/kvm/lib/guest_modes.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/kvm/lib/guest_modes.c b/tools/testing/selftests/kvm/lib/guest_modes.c
>> index 99a575bbbc52..1f2dca4520ab 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 = strtoul(arg, NULL, 10);
> While you are at it, can you also change strtoul to atoi_non_negative()?
>
> An underflow negative number will print an error message with a wrong
> positive guest mode ID not passed by the user.

Of course I can do that. Thanks for you Suggestion.

Thanks,

Shaoqin

>>          TEST_ASSERT(mode < NUM_VM_MODES, "Guest mode ID %d too big", mode);
>>          guest_modes[mode].enabled = true;
>>   }
>> --
>> 2.39.0
>>


      reply	other threads:[~2023-02-02  2:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  5:45 [PATCH] selftests: KVM: Replace optarg with arg in guest_modes_cmdline shahuang
2023-02-01 16:00 ` Vipin Sharma
2023-02-02  2:38   ` Shaoqin Huang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b847318-280f-8b9b-bafa-2ada86a54cfa@redhat.com \
    --to=shahuang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=vipinsh@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.