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]
Message-ID: <f12447b5-e26b-4f28-90e3-b5f61fdfcd6b@gmail.com>
Date: Mon, 30 Sep 2024 22:46:04 +0200
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: David Binderman <dcb314@...mail.com>,
 "jagathjog1996@...il.com" <jagathjog1996@...il.com>,
 "jic23@...nel.org" <jic23@...nel.org>, "lars@...afoo.de" <lars@...afoo.de>,
 "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
 Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: linux-6.12-rc1/drivers/iio/imu/bmi323/bmi323_core.c:133: Array
 contents defined but not used ?

On 30/09/2024 22:26, Nathan Chancellor wrote:
> Hi Javier,
> 
> On Mon, Sep 30, 2024 at 06:50:14PM +0200, Javier Carrasco wrote:
>> But if that wasn't the case, and since you can't use sizeof(<type>),
>> should it be marked with __maybe_unused / __attribute__((unused)) even
>> though it's known in advance that it won't be used, or at least that its
>> use will be to get its size?
> 
> Correct.
> 
>> Is it then just to silence the warning, or does it have other
>> implications? Thanks again!
> 
> Yes, the use of the unused attribute would just be to silence the
> warning; the variable would still not be emitted in the final binary.
> clang's behavior matches GCC's (aside from the special warning):
> 
> https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-unused-variable-attribute
> 
> If the variable needed to be emitted in the object file,
> __attribute__((used)) would need to be used, which explicitly has code
> generation implications:
> 
> https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-used-variable-attribute
> 
> A contrived example:
> 
> https://godbolt.org/z/oGGbqK98o
> 
> Cheers,
> Nathan

Thanks a lot for spoon-feeding it to me :)

Best regards,
Javier Carrasco

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ