Message ID | 20220510164520.768783-3-broonie@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | ffc8274c21938b30b10fcd6d4fc0feb29c222955 |
Headers | show |
Series | selftests/arm64: MTE check_tags_inclusion cleanups | expand |
On 5/10/22 10:45 AM, Mark Brown wrote: > mte_switch_mode() currently rejects attempts to set a zero tag however > there are tests such as check_tags_inclusion which attempt to cover cases > with zero tags using mte_switch_mode(). Since it is not clear why we are > rejecting zero tags change the test to accept them. > > The issue has not previously been as apparent as it should be since the > return value of mte_switch_mode() was not always checked in the callers > and the tests weren't otherwise failing. > > Signed-off-by: Mark Brown <broonie@kernel.org> > --- > tools/testing/selftests/arm64/mte/mte_common_util.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c > index 260206f4dce0..6ff4c4bcbff1 100644 > --- a/tools/testing/selftests/arm64/mte/mte_common_util.c > +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c > @@ -283,7 +283,7 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask) > return -EINVAL; > } > > - if (!(incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) { > + if (incl_mask & ~MT_INCLUDE_TAG_MASK) { > ksft_print_msg("FAIL: Invalid incl_mask %lx\n", incl_mask); > return -EINVAL; > } > 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 260206f4dce0..6ff4c4bcbff1 100644 --- a/tools/testing/selftests/arm64/mte/mte_common_util.c +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c @@ -283,7 +283,7 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask) return -EINVAL; } - if (!(incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) { + if (incl_mask & ~MT_INCLUDE_TAG_MASK) { ksft_print_msg("FAIL: Invalid incl_mask %lx\n", incl_mask); return -EINVAL; }
mte_switch_mode() currently rejects attempts to set a zero tag however there are tests such as check_tags_inclusion which attempt to cover cases with zero tags using mte_switch_mode(). Since it is not clear why we are rejecting zero tags change the test to accept them. The issue has not previously been as apparent as it should be since the return value of mte_switch_mode() was not always checked in the callers and the tests weren't otherwise failing. Signed-off-by: Mark Brown <broonie@kernel.org> --- tools/testing/selftests/arm64/mte/mte_common_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)