[PATCH v2] net: rxrpc: fix clang -Wformat warning
David Howells
dhowells at redhat.com
Fri Jul 8 02:39:04 PDT 2022
Justin Stitt <justinstitt at google.com> wrote:
> y is a u32 but the format specifier is `%hx`. Going from unsigned int to
> short int results in a loss of data. This is surely not intended
> behavior. If it is intended, the warning should be suppressed through
> other means.
Yeah, y is reduced to a 16-bit number so that it can be used in the protocol,
but the type is still 32-bit because that's needed for the calculation. An
alternative would be to print sp->hdr.cksum since that's the value that will
appear on the wire, but I've no objection to this change either.
> This patch should get us closer to the goal of enabling the -Wformat
> flag for Clang builds.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Justin Stitt <justinstitt at google.com>
Acked-by: David Howells <dhowells at redhat.com>
More information about the linux-afs
mailing list