mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: shahuang@redhat.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 v2] selftests: KVM: Replace optarg with arg in guest_modes_cmdline
Date: Thu, 2 Feb 2023 09:10:57 +0100	[thread overview]
Message-ID: <20230202081057.nanfjavyy2l4pswc@orel> (raw)
In-Reply-To: <20230202025716.216323-1-shahuang@redhat.com>

On Thu, Feb 02, 2023 at 10:57:15AM +0800, 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.
> 
> And this is the chance to change strtoul() to atoi_non_negative(), since
> guest mode ID will never be negative.

Fixes: e42ac777d661 ("KVM: selftests: Factor out guest mode code")

> 
> Signed-off-by: Shaoqin Huang <shahuang@redhat.com>
> 
> ---
> Changes from v1:
>   - Change strtoul() to atoi_non_negative(). [Vipin]
> 
> ---
>  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..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;
>  }
> -- 
> 2.39.0
> 

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>

  reply	other threads:[~2023-02-02  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02  2:57 shahuang
2023-02-02  8:10 ` Andrew Jones [this message]
2023-02-02 18:05   ` Vipin Sharma
2023-02-08  2:07 ` Sean Christopherson
2023-02-08 14:45   ` Sean Christopherson

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=20230202081057.nanfjavyy2l4pswc@orel \
    --to=andrew.jones@linux.dev \
    --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=shahuang@redhat.com \
    --cc=shuah@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®