lkml.org 
[lkml]   [2020]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel/sysctl.c: drop unneeded assignment in proc_do_large_bitmap()
On Mon, Oct 05, 2020 at 09:37:49PM +0100, Sudip Mukherjee wrote:
> The variable 'first' is assigned 0 inside the while loop in the if block
> but it is not used in the if block and is only used in the else block.
> So, remove the unneeded assignment.

True, but in this case, please move the definition of "first" into the
else block so it in only in scope there.

Thanks!

-Kees

>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>
> The resultant binary stayed same after this change. Verified with
> md5sum which remained same with and without this change.
>
> $ md5sum kernel/sysctl.o
> e9e97adbfd3f0b32f83dd35d100c0e4e kernel/sysctl.o
>
> kernel/sysctl.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index ce75c67572b9..b51ebfd1ba6e 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1508,7 +1508,6 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
> }
>
> bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
> - first = 0;
> proc_skip_char(&p, &left, '\n');
> }
> left += skipped;
> --
> 2.11.0
>

--
Kees Cook

\
 
 \ /
  Last update: 2020-10-05 23:06    [W:2.585 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site