Message ID | 20220310144335.2097457-4-broonie@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | f326c9a6f49b06c0a936d68ae23cb90899835c3b |
Headers | show |
Series | kselftest/arm64: Miscelaneous MTE test updates | expand |
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
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;
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(-)