public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Mark Brown <broonie@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>
Cc: Joey Gouly <joey.gouly@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kselftest@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v1 3/4] kselftest/arm64: Refactor parameter checking in mte_switch_mode()
Date: Thu, 10 Mar 2022 13:05:19 -0700	[thread overview]
Message-ID: <1255c2ba-07f6-628a-86e9-f255d1845e92@linuxfoundation.org> (raw)
In-Reply-To: <20220310144335.2097457-4-broonie@kernel.org>

On 3/10/22 7:43 AM, Mark Brown wrote:
> Currently we just have a big if statement with a non-specific diagnostic
> checking both the mode and the tag. Since we'll need to dynamically check
> for asymmetric mode support in the system and to improve debugability split
> these checks out.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>   .../testing/selftests/arm64/mte/mte_common_util.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c
> index 24b0c14203cb..9b4529ef2b29 100644
> --- a/tools/testing/selftests/arm64/mte/mte_common_util.c
> +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c
> @@ -271,9 +271,18 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask)
>   {
>   	unsigned long en = 0;
>   
> -	if (!(mte_option == MTE_SYNC_ERR || mte_option == MTE_ASYNC_ERR ||
> -	      mte_option == MTE_NONE_ERR || incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) {
> -		ksft_print_msg("FAIL: Invalid mte config option\n");
> +	switch (mte_option) {
> +	case MTE_NONE_ERR:
> +	case MTE_SYNC_ERR:
> +	case MTE_ASYNC_ERR:
> +		break;
> +	default:
> +		ksft_print_msg("FAIL: Invalid MTE option %x\n", mte_option);
> +		return -EINVAL;
> +	}
> +
> +	if (!(incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) {
> +		ksft_print_msg("FAIL: Invalid incl_mask %lx\n", incl_mask);
>   		return -EINVAL;
>   	}
>   	en = PR_TAGGED_ADDR_ENABLE;
> 

Looks good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

  reply	other threads:[~2022-03-10 20:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 14:43 [PATCH v1 0/4] kselftest/arm64: Miscelaneous MTE test updates Mark Brown
2022-03-10 14:43 ` [PATCH v1 1/4] kselftest/arm64: Handle more kselftest result codes in MTE helpers Mark Brown
2022-03-10 19:40   ` Shuah Khan
2022-03-10 14:43 ` [PATCH v1 2/4] kselftest/arm64: Log unexpected asynchronous MTE faults Mark Brown
2022-03-10 20:04   ` Shuah Khan
2022-03-10 14:43 ` [PATCH v1 3/4] kselftest/arm64: Refactor parameter checking in mte_switch_mode() Mark Brown
2022-03-10 20:05   ` Shuah Khan [this message]
2022-03-10 14:43 ` [PATCH v1 4/4] kselftest/arm64: Add simple test for MTE prctl Mark Brown
2022-03-10 15:33   ` Joey Gouly
2022-03-10 15:37     ` Mark Brown
2022-03-10 20:07   ` Shuah Khan

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=1255c2ba-07f6-628a-86e9-f255d1845e92@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=will@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