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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 27 Jul 2022 10:48:07 +0000 (UTC)
From:   Kalle Valo <kvalo@...nel.org>
To:     Justin Stitt <justinstitt@...gle.com>
Cc:     Gregory Greenman <gregory.greenman@...el.com>,
        "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>,
        Luca Coelho <luciano.coelho@...el.com>,
        Johannes Berg <johannes.berg@...el.com>,
        Avraham Stern <avraham.stern@...el.com>,
        Justin Stitt <justinstitt@...gle.com>,
        Miri Korenblit <miriam.rachel.korenblit@...el.com>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: wifi: iwlwifi: mvm: fix clang -Wformat warnings

Justin Stitt <justinstitt@...gle.com> wrote:

> When building with Clang we encounter these warnings:
> | drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1108:47: error:
> | format specifies type 'unsigned char' but the argument has type 's16'
> | (aka 'short') [-Werror,-Wformat] IWL_DEBUG_INFO(mvm, "\tburst index:
> | %hhu\n", res->ftm.burst_index);
> -
> | drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1111:47: error:
> | format specifies type 'unsigned char' but the argument has type 's32'
> | (aka 'int') [-Werror,-Wformat] IWL_DEBUG_INFO(mvm, "\trssi spread:
> | %hhu\n", res->ftm.rssi_spread);
> 
> The previous format specifier `%hhu` describes a u8 but our arguments
> are wider than this which means bits are potentially being lost.
> 
> 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
> `%hhu` to `%d` for both instances of the warning.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

Patch applied to wireless-next.git, thanks.

7819b3d1dab5 wifi: iwlwifi: mvm: fix clang -Wformat warnings

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220711222919.2043613-1-justinstitt@google.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ