]> git.baikalelectronics.ru Git - kernel.git/commit
net: l2tp: fix clang -Wformat warning
authorJustin Stitt <justinstitt@google.com>
Wed, 6 Jul 2022 23:08:33 +0000 (16:08 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 Jul 2022 01:07:01 +0000 (18:07 -0700)
commit56e6b9541a2e409cba1263634f440ea0a5e4891c
treecdfb62a4e1cd8d9f75d72d4fd79e3939d3a46e0f
parent73634d96bda0e6aaf8fa3a65863a9a4b006f3400
net: l2tp: fix clang -Wformat warning

When building with clang we encounter this warning:
| net/l2tp/l2tp_ppp.c:1557:6: error: format specifies type 'unsigned
| short' but the argument has type 'u32' (aka 'unsigned int')
| [-Werror,-Wformat] session->nr, session->ns,

Both session->nr and session->ns are of type u32. The format specifier
previously used is `%hu` which would truncate our unsigned integer from
32 to 16 bits. This doesn't seem like intended behavior, if it is then
perhaps we need to consider suppressing the warning with pragma clauses.

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: Guillaume Nault <gnault@redhat.com>
Link: https://lore.kernel.org/r/20220706230833.535238-1-justinstitt@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/l2tp/l2tp_ppp.c