Skip to contentSkip to conversation

x86, kaslr: add missed "static" declarations

PATCH In review Kees Cook 2 participants 3 messages Feb 9, 2014 – Feb 26, 2014 x86

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 x86, kaslr: add missed "static" declarations

This silences build warnings about unexported variables and functions.

---
 arch/x86/boot/compressed/aslr.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/boot/compressed/aslr.c +5 -4
index 90a21f430117..4dbf967da50d 100644
@@ -111,7 +111,7 @@ struct mem_vector {
 };
 
 #define MEM_AVOID_MAX 5
-struct mem_vector mem_avoid[MEM_AVOID_MAX];
+static struct mem_vector mem_avoid[MEM_AVOID_MAX];
 
 static bool mem_contains(struct mem_vector *region, struct mem_vector *item)
 {
@@ -180,7 +180,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
 }
 
 /* Does this memory vector overlap a known avoided area? */
-bool mem_avoid_overlap(struct mem_vector *img)
+static bool mem_avoid_overlap(struct mem_vector *img)
 {
 	int i;
 
@@ -192,8 +192,9 @@ bool mem_avoid_overlap(struct mem_vector *img)
 	return false;
 }
 
-unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / CONFIG_PHYSICAL_ALIGN];
-unsigned long slot_max = 0;
+static unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET /
+			   CONFIG_PHYSICAL_ALIGN];
+static unsigned long slot_max;
 
 static void slots_append(unsigned long addr)
 {
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
author
#1 lore raw
Quoted 45 lines · Kees Cook

This silences build warnings about unexported variables and functions.

---
 arch/x86/boot/compressed/aslr.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/boot/compressed/aslr.c +5 -5
index 90a21f430117..4dbf967da50d 100644
@@ -111,7 +111,7 @@ struct mem_vector {
 };
 
 #define MEM_AVOID_MAX 5
-struct mem_vector mem_avoid[MEM_AVOID_MAX];
+static struct mem_vector mem_avoid[MEM_AVOID_MAX];
 
 static bool mem_contains(struct mem_vector *region, struct mem_vector *item)
 {
@@ -180,7 +180,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
 }
 
 /* Does this memory vector overlap a known avoided area? */
-bool mem_avoid_overlap(struct mem_vector *img)
+static bool mem_avoid_overlap(struct mem_vector *img)
 {
        int i;
 
@@ -192,8 +192,9 @@ bool mem_avoid_overlap(struct mem_vector *img)
        return false;
 }
 
-unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / CONFIG_PHYSICAL_ALIGN];
-unsigned long slot_max = 0;
+static unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET /
+                          CONFIG_PHYSICAL_ALIGN];
+static unsigned long slot_max;
 
 static void slots_append(unsigned long addr)
 {
--

1.7.9.5

Quoted 3 lines

--
Kees Cook
Chrome OS Security

Ping on this patch; simple build warning fixes...

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#2 lore raw
In reply to Kees Cook
x86, kaslr: add missed "static" declarations
Commit-ID:  e290e8c59dbc2a15088d868170d799f763202fef
Gitweb:     http://git.kernel.org/tip/e290e8c59dbc2a15088d868170d799f763202fef
Author:     Kees Cook <[email protected]>
AuthorDate: Sun, 9 Feb 2014 13:56:44 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 25 Feb 2014 16:59:29 -0800

x86, kaslr: add missed "static" declarations

This silences build warnings about unexported variables and functions.

---
 arch/x86/boot/compressed/aslr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/boot/compressed/aslr.c +5 -4
index 90a21f4..4dbf967 100644
@@ -111,7 +111,7 @@ struct mem_vector {
 };
 
 #define MEM_AVOID_MAX 5
-struct mem_vector mem_avoid[MEM_AVOID_MAX];
+static struct mem_vector mem_avoid[MEM_AVOID_MAX];
 
 static bool mem_contains(struct mem_vector *region, struct mem_vector *item)
 {
@@ -180,7 +180,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
 }
 
 /* Does this memory vector overlap a known avoided area? */
-bool mem_avoid_overlap(struct mem_vector *img)
+static bool mem_avoid_overlap(struct mem_vector *img)
 {
 	int i;
 
@@ -192,8 +192,9 @@ bool mem_avoid_overlap(struct mem_vector *img)
 	return false;
 }
 
-unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / CONFIG_PHYSICAL_ALIGN];
-unsigned long slot_max = 0;
+static unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET /
+			   CONFIG_PHYSICAL_ALIGN];
+static unsigned long slot_max;
 
 static void slots_append(unsigned long addr)
 {