]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
sparc: Fix -Wstringop-overflow warning
authorOrlando Arias <oarias@knights.ucf.edu>
Tue, 16 May 2017 19:34:00 +0000 (15:34 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 May 2017 19:07:46 +0000 (12:07 -0700)
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>
arch/sparc/include/asm/pgtable_32.h
arch/sparc/include/asm/setup.h
arch/sparc/mm/init_32.c

index ce6f56980aefd2902bfae849eb90a993295976eb..cf190728360bbfb43621d23a7fb3a22c443a7399 100644 (file)
@@ -91,9 +91,9 @@ extern unsigned long pfn_base;
  * ZERO_PAGE is a global shared page that is always zero: used
  * for zero-mapped memory areas etc..
  */
-extern unsigned long empty_zero_page;
+extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
 
-#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page))
+#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
 
 /*
  * In general all page table modifications should use the V8 atomic
index 478bf6bb4598b345dd7f590beee86f43893e7645..3fae200dd251f094bad756ef145ec39882470d8e 100644 (file)
@@ -16,7 +16,7 @@ extern char reboot_command[];
  */
 extern unsigned char boot_cpu_id;
 
-extern unsigned long empty_zero_page;
+extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
 
 extern int serial_console;
 static inline int con_is_present(void)
index c6afe98de4d9aba5ebad292031735988afd8180d..3bd0d513bddbde7f95275be6e3ae94bd26729c6f 100644 (file)
@@ -290,7 +290,7 @@ void __init mem_init(void)
 
 
        /* Saves us work later. */
-       memset((void *)&empty_zero_page, 0, PAGE_SIZE);
+       memset((void *)empty_zero_page, 0, PAGE_SIZE);
 
        i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5);
        i += 1;