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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 4 Oct 2021 11:22:44 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     Chris Down <chris@...isdown.name>
Cc:     Arnd Bergmann <arnd@...nel.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Arnd Bergmann <arnd@...db.de>,
        Steven Rostedt <rostedt@...dmis.org>,
        John Ogness <john.ogness@...utronix.de>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        YueHaibing <yuehaibing@...wei.com>, Jessica Yu <jeyu@...nel.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] [v2] printk: avoid -Wsometimes-uninitialized warning

On Tue 2021-09-28 11:17:26, Chris Down wrote:
> Arnd Bergmann writes:
> > From: Arnd Bergmann <arnd@...db.de>
> > 
> > clang notices that the pi_get_entry() function would use
> > uninitialized data if it was called with a non-NULL module
> > pointer on a kernel that does not support modules:
> > 
> > kernel/printk/index.c:32:6: error: variable 'nr_entries' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> >        if (!mod) {
> >            ^~~~
> > kernel/printk/index.c:38:13: note: uninitialized use occurs here
> >        if (pos >= nr_entries)
> >                   ^~~~~~~~~~
> > kernel/printk/index.c:32:2: note: remove the 'if' if its condition is always true
> >        if (!mod) {
> > 
> > Rework the condition to make it clear to the compiler that we are always
> > in the second case. Unfortunately the #ifdef is still required as the
> > definition of 'struct module' is hidden when modules are disabled.
> > 
> > Fixes: 337015573718 ("printk: Userspace format indexing support")
> 
> This changelog should make it clear that this is theoretical and will never
> actually happen, which is salient information for people who are considering
> whether it should go in stable or similar.

IMHO, the sentence "Rework the condition to make it clear that this
is theoretical and will never actually happen" is rather clear.

Well, I am not a native speaker.

Anyway, I have pushed the patch into printk/linux.git, branch
for-5.16.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ