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: Fri, 16 Feb 2024 21:19:02 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Cristian Marussi" <cristian.marussi@....com>,
 "Arnd Bergmann" <arnd@...nel.org>
Cc: "Sudeep Holla" <sudeep.holla@....com>,
 "Nathan Chancellor" <nathan@...nel.org>,
 "Nick Desaulniers" <ndesaulniers@...gle.com>,
 "Bill Wendling" <morbo@...gle.com>, "Justin Stitt" <justinstitt@...gle.com>,
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
 llvm@...ts.linux.dev
Subject: Re: [PATCH] firmware: arm_scmi: avoid returning uninialized data

On Fri, Feb 16, 2024, at 18:21, Cristian Marussi wrote:
> On Fri, Feb 16, 2024 at 05:32:53PM +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@...db.de>
>> 
>> Clang notices that there is a code path through
>> scmi_powercap_notify_supported() that returns an
>> undefined value:
>> 
>
> thanks for looking at this, this series that I've just posted is still
> to be reviewd at all, so I would expect issues :D...BUT in this case I
> dont think that the clang report is valid since, inside the culprit
> function scmi_powercap_notify_supported(), a few lines before the
> reported usage of unitialized data there is a check (@line 816) on the
> 'bounds' of evt_id itself
>
> 	if (evt_id >= ARRAY_SIZE(evt_2_cmd) || src_id >= pi->num_domains)
> 		return false;
>
> so basically the mentioned if/else WILL be evaluated in some of its
> branches for sure and supported wont be uninitialized.
>
> Indeed, I removed from here (and from all the series) the explicit
> initialization at definition time right before posting the series.
>
> Having saidm that...maybe it is just brain-dead this approach of mine
> since it is able to fool clang & friends...I would add bACK an explicit
> initialization of supported all across this series in V2, if this
> sounds good to you.

I'm fine with any solution that avoids the warning. I usually
prefer the explicit assignment where it's needed over having
it as part of the declaration, and in this case I would
probably pick a switch/case of a set of if/else fi/else
blocks

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ