[PATCH 5/8] kselftest/arm64: mte: fix printf type warning about mask
Mark Brown
broonie at kernel.org
Fri Aug 16 10:07:58 PDT 2024
On Fri, Aug 16, 2024 at 05:55:48PM +0100, Andre Przywara wrote:
> Mark Brown <broonie at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240816/12871ce6/attachment.sig>
More information about the linux-arm-kernel
mailing list