2011-05-07 14:11:48

by Stratos Psomadakis

[permalink] [raw]
Subject: [PATCH 0/2] ppc/cleaup: Fix compiler warnings

Fix compiler warnings in ppc code, which can lead to build failure, if
CONFIG_PPC_WERROR is set (default).

arch/powerpc/include/asm/pgtable-ppc64.h | 13 ++++++-------
arch/powerpc/kernel/Makefile | 2 +-
2 files changed, 7 insertions(+), 8 deletions(-)


2011-05-07 14:11:47

by Stratos Psomadakis

[permalink] [raw]
Subject: [PATCH 1/2] ppc: Fix compiler warning in ptrace.c [-Wno-array-bounds]

The trick used to bypass the thread_struct fpr array in order to access the
struct fpscr, in arch/powerpc/kernel/ptrace.c, can trigger an "array subscript
is above array bounds [-Werror=array-bounds]" warning.

Add -Wno-array-bounds to CFLAGS_ptrace.o, in arch/powerpc/kernel/Makefile to
slience this warning.

Signed-off-by: Stratos Psomadakis <[email protected]>
---
arch/powerpc/kernel/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 3bb2a3e..92b1002 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#

-CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
+CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' -Wno-array-bounds

subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror

--
1.5.6.5

2011-05-07 14:11:45

by Stratos Psomadakis

[permalink] [raw]
Subject: [PATCH 2/2] ppc64: Fix compiler warning in pgtable-ppc64.h [-Wunused-but-set-variable]

The variable 'old' is set but not used in the wrprotect functions in
arch/powerpc/include/asm/pgtable-ppc64.h, which can trigger a compiler warning.

Remove the variable, since it's not used anyway.

Signed-off-by: Stratos Psomadakis <[email protected]>
---
arch/powerpc/include/asm/pgtable-ppc64.h | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 2b09cd5..0b27dba 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -257,21 +257,20 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
pte_t *ptep)
{
- unsigned long old;

- if ((pte_val(*ptep) & _PAGE_RW) == 0)
- return;
- old = pte_update(mm, addr, ptep, _PAGE_RW, 0);
+ if ((pte_val(*ptep) & _PAGE_RW) == 0)
+ return;
+
+ pte_update(mm, addr, ptep, _PAGE_RW, 0);
}

static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
unsigned long addr, pte_t *ptep)
{
- unsigned long old;
-
if ((pte_val(*ptep) & _PAGE_RW) == 0)
return;
- old = pte_update(mm, addr, ptep, _PAGE_RW, 1);
+
+ pte_update(mm, addr, ptep, _PAGE_RW, 1);
}

/*
--
1.5.6.5

2011-05-07 15:18:23

by Andreas Schwab

[permalink] [raw]
Subject: Re: [PATCH 1/2] ppc: Fix compiler warning in ptrace.c [-Wno-array-bounds]

Stratos Psomadakis <[email protected]> writes:

> +CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' -Wno-array-bounds

You need to check first whether the option is valid.

Andreas.

--
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2011-05-07 15:54:45

by Stratos Psomadakis

[permalink] [raw]
Subject: [RESEND PATCH 1/2] ppc: Fix compiler warning in ptrace.c [-Wno-array-bounds]

The trick used to bypass the thread_struct fpr array in order to access the
struct fpscr, in arch/powerpc/kernel/ptrace.c, can trigger an "array subscript
is above array bounds [-Werror=array-bounds]" warning.

Add -Wno-array-bounds to CFLAGS_ptrace.o, in arch/powerpc/kernel/Makefile to
slience this warning.

Signed-off-by: Stratos Psomadakis <[email protected]>
---
arch/powerpc/kernel/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 3bb2a3e..92b1002 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#

-CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
+CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' $(call cc-option, -Wno-array-bounds)

subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror

--
1.5.6.5

2011-05-07 15:57:22

by Stratos Psomadakis

[permalink] [raw]
Subject: Re: [PATCH 1/2] ppc: Fix compiler warning in ptrace.c [-Wno-array-bounds]

On 05/07/2011 06:18 PM, Andreas Schwab wrote:
> Stratos Psomadakis <[email protected]> writes:
>
>> +CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' -Wno-array-bounds
> You need to check first whether the option is valid.
>
> Andreas.
>
I resent the patch, with $(call cc-option) to check if GCC supports the
option. Is it ok?

Thx.

--
Stratos Psomadakis
<[email protected]>

2011-05-08 20:03:14

by Stratos Psomadakis

[permalink] [raw]
Subject: Re: [PATCH 0/2] ppc/cleaup: Fix compiler warnings

On 05/07/2011 05:11 PM, Stratos Psomadakis wrote:
> Fix compiler warnings in ppc code, which can lead to build failure, if
> CONFIG_PPC_WERROR is set (default).
>
> arch/powerpc/include/asm/pgtable-ppc64.h | 13 ++++++-------
> arch/powerpc/kernel/Makefile | 2 +-
> 2 files changed, 7 insertions(+), 8 deletions(-)
forgot to cc the maintainers

--
Stratos Psomadakis
<[email protected]>