On Fri, Aug 16, 2024 at 05:55:48PM +0100, Andre Przywara wrote:
Mark Brown broonie@kernel.org wrote:
On Fri, Aug 16, 2024 at 04:32:48PM +0100, Andre Przywara wrote:
ksft_print_msg("Got %x, expected %x\n",
(ret & PR_MTE_TCF_MASK), mask);
(ret & (int)PR_MTE_TCF_MASK), mask);
TBH my inclination is that this is worse than letting the value be promoted, casts (particularly casts of constants) are just obviously suspect in a way that printf() formats aren't.
Fair enough, I wasn't sure about this either, and indeed this down-cast of a constant smells dodgy. So shall I just use %lx, and rely on the promotion (so the MASK being defined as UL), or cast "ret" to long?
My inclination would be to go with the former.