x86/kaslr: remove useless code in mem_avoid_memmap
PATCH 1/1 x86/kaslr: remove useless code in mem_avoid_memmap
MAX_MEMMAP_REGIONS is a macro that equal to 4. "i" is static local variable that default to 0. The comparison "i >= MAX_MEMMAP_REGIONS" will always be false.
--- arch/x86/boot/compressed/kaslr.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/boot/compressed/kaslr.c +0 -3
@@ -176,9 +176,6 @@ static void mem_avoid_memmap(char *str) {static int i; -if (i >=MAX_MEMMAP_REGIONS ) -return ; -while (str && (i <MAX_MEMMAP_REGIONS )) {int rc;unsigned long long start, size;
Signature · 1 line
1.8.3.1
Quoted 3 lines · Qian Cai
MAX_MEMMAP_REGIONSis a macro that equal to 4. "i" is static local variable that default to 0. The comparison "i >=MAX_MEMMAP_REGIONS" will always be false.
Seems not true. mem_avoid_memmap() could be invoked many times if multiple memmap= added. It will carry the value accumulated from the past.
Quoted 23 lines
Signed-off-by Qian Cai <[email protected]>--- arch/x86/boot/compressed/kaslr.c | 3 --- 1 file changed, 3 deletions(-)arch/x86/boot/compressed/kaslr.c +0
-3@@ -176,9 +176,6 @@ static void mem_avoid_memmap(char *str) {static int i; -if (i >=MAX_MEMMAP_REGIONS ) -return ; -while (str && (i <MAX_MEMMAP_REGIONS )) {int rc;unsigned long long start, size;Signature · 1 line
1.8.3.1
Quoted 8 lines · Baoquan He
Quoted 3 lines · Qian Cai
MAX_MEMMAP_REGIONSis a macro that equal to 4. "i" is static local variable that default to 0. The comparison "i >=MAX_MEMMAP_REGIONS" will always be false.Seems not true.
mem_avoid_memmap()could be invoked many times if multiple memmap= added. It will carry the value accumulated from the past.
Ah, I am still a newbie in C after all those years. Sorry for the noise.
Quoted 25 lines
Quoted 25 lines
Signed-off-by Qian Cai <[email protected]>---
arch/x86/boot/compressed/kaslr.c | 3 ---1 file changed, 3 deletions(-)arch/x86/boot/compressed/kaslr.c +0
-0@@ -176,9 +176,6 @@ static void mem_avoid_memmap(char *str) { static int i;arch/x86/boot/compressed/kaslr.c +0
-3-if (i >=MAX_MEMMAP_REGIONS ) -return ; -while (str && (i <
MAX_MEMMAP_REGIONS)) {
int rc;
unsigned long long start, size;
--
1.8.3.1