Skip to content

Commit

Permalink
sparc: Fix -Wstringop-overflow warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Orlando Arias authored and David S. Miller committed May 17, 2017
1 parent b6c41cb commit deba804
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions arch/sparc/include/asm/pgtable_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit deba804

Please sign in to comment.