[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220708100847.GA26192@debian.home>
Date: Fri, 8 Jul 2022 12:08:47 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Justin Stitt <justinstitt@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, Tom Parkin <tparkin@...alix.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH] l2tp: l2tp_debugfs: fix Clang -Wformat warnings
On Thu, Jul 07, 2022 at 03:14:56PM -0700, Justin Stitt wrote:
> When building with Clang we encounter the following warnings:
> | net/l2tp/l2tp_debugfs.c:187:40: error: format specifies type 'unsigned
> | short' but the argument has type 'u32' (aka 'unsigned int')
> | [-Werror,-Wformat] seq_printf(m, " nr %hu, ns %hu\n", session->nr,
> | session->ns);
> -
> | net/l2tp/l2tp_debugfs.c:196:32: error: format specifies type 'unsigned
> | short' but the argument has type 'int' [-Werror,-Wformat]
> | session->l2specific_type, l2tp_get_l2specific_len(session));
> -
> | net/l2tp/l2tp_debugfs.c:219: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 ->nc are of type `u32`. The currently used format
> specifier is `%hu` which describes a `u16`. My proposed fix is to listen
> to Clang and use the correct format specifier `%u`.
>
> For the warning at line 196, l2tp_get_l2specific_len() returns an int
> and should therefore be using the `%d` format specifier.
Acked-by: Guillaume Nault <gnault@...hat.com>
Powered by blists - more mailing lists