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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 8 Nov 2017 16:45:28 -0800
From:   Kees Cook <keescook@...omium.org>
To:     mail@...l.no
Cc:     "Luis R. Rodriguez" <mcgrof@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Fix: Removed warning.

On Wed, Nov 8, 2017 at 1:08 PM, Ola Næss Kaldestad <mail@...l.no> wrote:
> Removed unnecessary else statement after return.
>
> Signed-off-by: Ola N. Kaldestad <mail@...l.no>
> ---
> kernel/sysctl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index d9c31bc2eaea..f5a3defff52d 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -3093,10 +3093,10 @@ int proc_do_large_bitmap(struct ctl_table *table,
> int write,
> *lenp -= left;
> *ppos += *lenp;
> return 0;
> - } else {
> - kfree(tmp_bitmap);
> - return err;
> }
> +
> + kfree(tmp_bitmap);
> + return err;
> }
>
> #else /* CONFIG_PROC_SYSCTL */
>

This patch appears to be white-space damaged. I think this could
actually be improved further too, since the "if" case also does
kfree(tmp_bitmap); and return err; (where err==0). Maybe just this,
instead? (This patch will probably be whitespace damaged too, via
gmail.)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d9c31bc2eaea..87fbb3e966d5 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3089,14 +3089,12 @@ int proc_do_large_bitmap(struct ctl_table
*table, int write,
                        else
                                bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
                }
-               kfree(tmp_bitmap);
                *lenp -= left;
                *ppos += *lenp;
-               return 0;
-       } else {
-               kfree(tmp_bitmap);
-               return err;
        }
+
+       kfree(tmp_bitmap);
+       return err;
 }

 #else /* CONFIG_PROC_SYSCTL */




-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists