diff options
author | Orlando Arias <oarias@knights.ucf.edu> | 2017-05-16 15:34:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-17 15:07:46 -0400 |
commit | deba804c90642c8ed0f15ac1083663976d578f54 (patch) | |
tree | 90881a5181651c09e8fd8ceb9d62eb65bf556008 | |
parent | b6c41cb050d5debc7e4eaa0a81cbdbad72588891 (diff) |
sparc: Fix -Wstringop-overflow warning
Greetings,
GCC 7 introduced the -Wstringop-overflow flag to detect buffer overflows
in calls to string handling functions [1][2]. Due to the way
``empty_zero_page'' is declared in arch/sparc/include/setup.h, this
causes a warning to trigger at compile time in the function mem_init(),
which is subsequently converted to an error. The ensuing patch fixes
this issue and aligns the declaration of empty_zero_page to that of
other architectures. Thank you.
Cheers,
Orlando.
[1] https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02308.html
[2] https://gcc.gnu.org/gcc-7/changes.html
Signed-off-by: Orlando Arias <oarias@knights.ucf.edu>
--------------------------------------------------------------------------------
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/include/asm/pgtable_32.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/setup.h | 2 | ||||
-rw-r--r-- | arch/sparc/mm/init_32.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index ce6f56980aef..cf190728360b 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h | |||
@@ -91,9 +91,9 @@ extern unsigned long pfn_base; | |||
91 | * ZERO_PAGE is a global shared page that is always zero: used | 91 | * ZERO_PAGE is a global shared page that is always zero: used |
92 | * for zero-mapped memory areas etc.. | 92 | * for zero-mapped memory areas etc.. |
93 | */ | 93 | */ |
94 | extern unsigned long empty_zero_page; | 94 | extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
95 | 95 | ||
96 | #define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) | 96 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * In general all page table modifications should use the V8 atomic | 99 | * In general all page table modifications should use the V8 atomic |
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h index 478bf6bb4598..3fae200dd251 100644 --- a/arch/sparc/include/asm/setup.h +++ b/arch/sparc/include/asm/setup.h | |||
@@ -16,7 +16,7 @@ extern char reboot_command[]; | |||
16 | */ | 16 | */ |
17 | extern unsigned char boot_cpu_id; | 17 | extern unsigned char boot_cpu_id; |
18 | 18 | ||
19 | extern unsigned long empty_zero_page; | 19 | extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
20 | 20 | ||
21 | extern int serial_console; | 21 | extern int serial_console; |
22 | static inline int con_is_present(void) | 22 | static inline int con_is_present(void) |
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index c6afe98de4d9..3bd0d513bddb 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -290,7 +290,7 @@ void __init mem_init(void) | |||
290 | 290 | ||
291 | 291 | ||
292 | /* Saves us work later. */ | 292 | /* Saves us work later. */ |
293 | memset((void *)&empty_zero_page, 0, PAGE_SIZE); | 293 | memset((void *)empty_zero_page, 0, PAGE_SIZE); |
294 | 294 | ||
295 | i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); | 295 | i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); |
296 | i += 1; | 296 | i += 1; |