All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Fix: code-style warning
       [not found] <20171113232654.9473-1-mail@okal.no>
@ 2017-11-13 23:41 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2017-11-13 23:41 UTC (permalink / raw)
  To: Ola N. Kaldestad, Andrew Morton; +Cc: Luis R. Rodriguez, linux-fsdevel

On Mon, Nov 13, 2017 at 3:26 PM, Ola N. Kaldestad <mail@okal.no> wrote:
> Removed unnecessary else block, and removed redundant return and call to kfree in if block.
>
> Signed-off-by: Ola N. Kaldestad <mail@okal.no>

Thanks for resending this. Andrew, can you take this clean-up, please?

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  kernel/sysctl.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index d9c31bc2eaea..83b1685d3f15 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -3089,14 +3089,11 @@ 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 */
> --
> 2.7.4
>



-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Fix code-style warning
@ 2017-11-09 14:40 Ola N. Kaldestad
  0 siblings, 0 replies; 2+ messages in thread
From: Ola N. Kaldestad @ 2017-11-09 14:40 UTC (permalink / raw)
  To: keescook; +Cc: mcgrof, linux-kernel, linux-fsdevel, Ola N. Kaldestad

Removed unnecessary else block, and removed redundant return and call to kfree in if block.

Signed-off-by: Ola N. Kaldestad <mail@okal.no>
---
 kernel/sysctl.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d9c31bc..87fbb3e 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 */
--
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-13 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20171113232654.9473-1-mail@okal.no>
2017-11-13 23:41 ` [PATCH] Fix: code-style warning Kees Cook
2017-11-09 14:40 [PATCH] Fix " Ola N. Kaldestad

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.