* [PATCH] kaslr: clean up a useless variable and some usless space
@ 2017-11-23 9:08 Chao Fan
2017-11-23 16:34 ` Thomas Gleixner
2017-11-23 19:24 ` [tip:x86/urgent] x86/boot/KASLR: Remove unused variable tip-bot for Chao Fan
0 siblings, 2 replies; 4+ messages in thread
From: Chao Fan @ 2017-11-23 9:08 UTC (permalink / raw)
To: hpa, tglx, mingo, x86, keescook, gregkh, n-horiguchi, linux-kernel
Cc: Chao Fan
There are two same variable "rc" in mem_avoid_memmap. One is in the
circulation, the other is out of the circulation. The one out will never
be used, so drop it.
Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
---
arch/x86/boot/compressed/kaslr.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index a63fbc25ce84..8199a6187251 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -171,7 +171,6 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
static void mem_avoid_memmap(char *str)
{
static int i;
- int rc;
if (i >= MAX_MEMMAP_REGIONS)
return;
@@ -219,7 +218,7 @@ static int handle_mem_memmap(void)
return 0;
tmp_cmdline = malloc(len + 1);
- if (!tmp_cmdline )
+ if (!tmp_cmdline)
error("Failed to allocate space for tmp_cmdline");
memcpy(tmp_cmdline, args, len);
@@ -363,7 +362,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
cmd_line |= boot_params->hdr.cmd_line_ptr;
/* Calculate size of cmd_line. */
ptr = (char *)(unsigned long)cmd_line;
- for (cmd_line_size = 0; ptr[cmd_line_size++]; )
+ for (cmd_line_size = 0; ptr[cmd_line_size++];)
;
mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;
--
2.14.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kaslr: clean up a useless variable and some usless space
2017-11-23 9:08 [PATCH] kaslr: clean up a useless variable and some usless space Chao Fan
@ 2017-11-23 16:34 ` Thomas Gleixner
2017-11-23 16:35 ` Thomas Gleixner
2017-11-23 19:24 ` [tip:x86/urgent] x86/boot/KASLR: Remove unused variable tip-bot for Chao Fan
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-11-23 16:34 UTC (permalink / raw)
To: Chao Fan; +Cc: hpa, mingo, x86, keescook, gregkh, n-horiguchi, linux-kernel
On Thu, 23 Nov 2017, Chao Fan wrote:
> There are two same variable "rc" in mem_avoid_memmap. One is in the
> circulation, the other is out of the circulation. The one out will never
> be used, so drop it.
>
> Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
> ---
> arch/x86/boot/compressed/kaslr.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> index a63fbc25ce84..8199a6187251 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -171,7 +171,6 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
> static void mem_avoid_memmap(char *str)
> {
> static int i;
> - int rc;
>
> if (i >= MAX_MEMMAP_REGIONS)
> return;
> @@ -219,7 +218,7 @@ static int handle_mem_memmap(void)
> return 0;
>
> tmp_cmdline = malloc(len + 1);
> - if (!tmp_cmdline )
> + if (!tmp_cmdline)
> error("Failed to allocate space for tmp_cmdline");
This change is unrelated.
>
> memcpy(tmp_cmdline, args, len);
> @@ -363,7 +362,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
> cmd_line |= boot_params->hdr.cmd_line_ptr;
> /* Calculate size of cmd_line. */
> ptr = (char *)(unsigned long)cmd_line;
> - for (cmd_line_size = 0; ptr[cmd_line_size++]; )
> + for (cmd_line_size = 0; ptr[cmd_line_size++];)
Ditto.
> ;
> mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
> mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kaslr: clean up a useless variable and some usless space
2017-11-23 16:34 ` Thomas Gleixner
@ 2017-11-23 16:35 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2017-11-23 16:35 UTC (permalink / raw)
To: Chao Fan; +Cc: hpa, mingo, x86, keescook, gregkh, n-horiguchi, linux-kernel
On Thu, 23 Nov 2017, Thomas Gleixner wrote:
> On Thu, 23 Nov 2017, Chao Fan wrote:
>
> > There are two same variable "rc" in mem_avoid_memmap. One is in the
> > circulation, the other is out of the circulation. The one out will never
> > be used, so drop it.
> >
> > Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
> > ---
> > arch/x86/boot/compressed/kaslr.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> > index a63fbc25ce84..8199a6187251 100644
> > --- a/arch/x86/boot/compressed/kaslr.c
> > +++ b/arch/x86/boot/compressed/kaslr.c
> > @@ -171,7 +171,6 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
> > static void mem_avoid_memmap(char *str)
> > {
> > static int i;
> > - int rc;
> >
> > if (i >= MAX_MEMMAP_REGIONS)
> > return;
> > @@ -219,7 +218,7 @@ static int handle_mem_memmap(void)
> > return 0;
> >
> > tmp_cmdline = malloc(len + 1);
> > - if (!tmp_cmdline )
> > + if (!tmp_cmdline)
> > error("Failed to allocate space for tmp_cmdline");
>
> This change is unrelated.
Never mind. Just noticed that it's mentioned in $subject.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:x86/urgent] x86/boot/KASLR: Remove unused variable
2017-11-23 9:08 [PATCH] kaslr: clean up a useless variable and some usless space Chao Fan
2017-11-23 16:34 ` Thomas Gleixner
@ 2017-11-23 19:24 ` tip-bot for Chao Fan
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Chao Fan @ 2017-11-23 19:24 UTC (permalink / raw)
To: linux-tip-commits; +Cc: hpa, tglx, mingo, fanc.fnst, linux-kernel
Commit-ID: 69550d41ff9c884c6d996fca41037974b2255852
Gitweb: https://git.kernel.org/tip/69550d41ff9c884c6d996fca41037974b2255852
Author: Chao Fan <fanc.fnst@cn.fujitsu.com>
AuthorDate: Thu, 23 Nov 2017 17:08:47 +0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 23 Nov 2017 20:17:59 +0100
x86/boot/KASLR: Remove unused variable
There are two variables "rc" in mem_avoid_memmap. One at the top of the
function and another one inside the while() loop. Drop the outer one as it
is unused. Cleanup some whitespace damage while at it.
Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: gregkh@linuxfoundation.org
Cc: n-horiguchi@ah.jp.nec.com
Cc: keescook@chromium.org
Link: https://lkml.kernel.org/r/20171123090847.15293-1-fanc.fnst@cn.fujitsu.com
---
arch/x86/boot/compressed/kaslr.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index a63fbc2..8199a61 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -171,7 +171,6 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
static void mem_avoid_memmap(char *str)
{
static int i;
- int rc;
if (i >= MAX_MEMMAP_REGIONS)
return;
@@ -219,7 +218,7 @@ static int handle_mem_memmap(void)
return 0;
tmp_cmdline = malloc(len + 1);
- if (!tmp_cmdline )
+ if (!tmp_cmdline)
error("Failed to allocate space for tmp_cmdline");
memcpy(tmp_cmdline, args, len);
@@ -363,7 +362,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
cmd_line |= boot_params->hdr.cmd_line_ptr;
/* Calculate size of cmd_line. */
ptr = (char *)(unsigned long)cmd_line;
- for (cmd_line_size = 0; ptr[cmd_line_size++]; )
+ for (cmd_line_size = 0; ptr[cmd_line_size++];)
;
mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-23 19:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23 9:08 [PATCH] kaslr: clean up a useless variable and some usless space Chao Fan
2017-11-23 16:34 ` Thomas Gleixner
2017-11-23 16:35 ` Thomas Gleixner
2017-11-23 19:24 ` [tip:x86/urgent] x86/boot/KASLR: Remove unused variable tip-bot for Chao Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).