lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 14 Jul 2022 12:32:49 +0200
From:   Steffen Klassert <steffen.klassert@...unet.com>
To:     Justin Stitt <justinstitt@...gle.com>
CC:     Herbert Xu <herbert@...dor.apana.org.au>,
        "David S . Miller" <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        "David Ahern" <dsahern@...nel.org>,
        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>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <llvm@...ts.linux.dev>,
        Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v2] net: ipv4: fix clang -Wformat warnings

On Fri, Jul 08, 2022 at 05:37:04PM -0700, Justin Stitt wrote:
> When building with Clang we encounter these warnings:
> | net/ipv4/ah4.c:513:4: error: format specifies type 'unsigned short' but
> | the argument has type 'int' [-Werror,-Wformat]
> | aalg_desc->uinfo.auth.icv_fullbits / 8);
> -
> | net/ipv4/esp4.c:1114:5: error: format specifies type 'unsigned short'
> | but the argument has type 'int' [-Werror,-Wformat]
> | aalg_desc->uinfo.auth.icv_fullbits / 8);
> 
> `aalg_desc->uinfo.auth.icv_fullbits` is a u16 but due to default
> argument promotion becomes an int.
> 
> Variadic functions (printf-like) undergo default argument promotion.
> Documentation/core-api/printk-formats.rst specifically recommends using
> the promoted-to-type's format flag.
> 
> As per C11 6.3.1.1:
> (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) `If an int
> can represent all values of the original type ..., the value is
> converted to an int; otherwise, it is converted to an unsigned int.
> These are called the integer promotions.` Thus it makes sense to change
> %hu to %d not only to follow this standard but to suppress the warning
> as well.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> Suggested-by: Joe Perches <joe@...ches.com>
> Suggested-by: Nathan Chancellor <nathan@...nel.org>
> Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>

Applied to the ipsec tree, thanks a lot!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ