Messages in this thread | | | From | David Howells <> | Subject | Re: [PATCH v2] net: rxrpc: fix clang -Wformat warning | Date | Fri, 08 Jul 2022 10:39:04 +0100 |
| |
Justin Stitt <justinstitt@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@google.com>
Acked-by: David Howells <dhowells@redhat.com>
| |