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, 11 Mar 2020 04:30:21 +0100
From:   Christian Brauner <christian.brauner@...ntu.com>
To:     John Hubbard <jhubbard@...dia.com>
Cc:     Stephen Rothwell <sfr@...b.auug.org.au>,
        Linux Next <linux-next@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pid: fix uninitialized retval in alloc_pid()

On Tue, Mar 10, 2020 at 08:21:53PM -0700, John Hubbard wrote:
> Commit 8deb24dcb89cb ("pid: make ENOMEM return value more obvious")
> left the return value uninitialized in one error case. The justification
> for the above commit included a statement that retval is "initialized on
> ever[y] failure path in the loop". However, that is not quite good
> enough because there is an earlier case that is before the loop. And
> also, it's more maintenance and merge-safe to initialize it once at the
> top, as evidenced by this build warning that we now have.
> 
> Therefore, restore the top-level initialization of retval.
> 
> Also move the descriptive comment up, and remove the now-redundant
> later initialization of retval.
> 
> Fixes: 8deb24dcb89cb ("pid: make ENOMEM return value more obvious")
> Cc: Christian Brauner <christian.brauner@...ntu.com>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>

Thanks. I already have a fixed-up version in my tree after Stephen
reported it earlier today:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=fixes&id=10dab84caf400f2f5f8b010ebb0c7c4272ec5093

(Fwiw, we can't just move the it back up. It needs to be set after the
loop too because it can be set to EPERM before. See
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=fixes&id=b26ebfe12f34f372cf041c6f801fa49c3fb382c5
for the motiviation for the comment.)

Christian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ