From: Joel Stanley <joel@jms.id.au>
To: linuxppc-dev@lists.ozlabs.org
Cc: Anton Blanchard <anton@samba.org>,
Anton Blanchard <anton@ozlabs.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: [PATCH v2 4/5] powerpc: Fix duplicate const clang warning in user access code
Date: Fri, 14 Sep 2018 13:36:48 +0930 [thread overview]
Message-ID: <20180914040649.1794-5-joel@jms.id.au> (raw)
In-Reply-To: <20180914040649.1794-1-joel@jms.id.au>
From: Anton Blanchard <anton@samba.org>
This re-applies b91c1e3e7a6f which was reverted in f2ca80905929
d466f6c5cac1 f84ed59a612d (powerpc/sparse: Constify the address pointer
...").
We see a large number of duplicate const errors in the user access
code when building with llvm/clang:
include/linux/pagemap.h:576:8: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
ret = __get_user(c, uaddr);
The problem is we are doing const __typeof__(*(ptr)), which will hit the
warning if ptr is marked const.
Removing const does not seem to have any effect on GCC code generation.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
If we don't want to apply this, other options are suppressing the
warning, or wait for a fix to land in clang
(https://github.com/ClangBuiltLinux/linux/issues/52).
---
arch/powerpc/include/asm/uaccess.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index bac225bb7f64..15bea9a0f260 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -260,7 +260,7 @@ do { \
({ \
long __gu_err; \
__long_type(*(ptr)) __gu_val; \
- const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
+ __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
__chk_user_ptr(ptr); \
if (!is_kernel_addr((unsigned long)__gu_addr)) \
might_fault(); \
@@ -274,7 +274,7 @@ do { \
({ \
long __gu_err = -EFAULT; \
__long_type(*(ptr)) __gu_val = 0; \
- const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
+ __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
might_fault(); \
if (access_ok(VERIFY_READ, __gu_addr, (size))) { \
barrier_nospec(); \
@@ -288,7 +288,7 @@ do { \
({ \
long __gu_err; \
__long_type(*(ptr)) __gu_val; \
- const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
+ __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
__chk_user_ptr(ptr); \
barrier_nospec(); \
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
--
2.17.1
next prev parent reply other threads:[~2018-09-14 4:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-14 4:06 [PATCH v2 0/5] powerpc: Clang build fixes Joel Stanley
2018-09-14 4:06 ` [PATCH v2 1/5] powerpc/Makefiles: Fix clang/llvm build Joel Stanley
2018-09-14 17:41 ` Nick Desaulniers
2018-09-20 7:04 ` Joel Stanley
2018-09-14 4:06 ` [PATCH v2 2/5] powerpc/boot: Fix crt0.S syntax for clang Joel Stanley
2018-09-14 17:47 ` Nick Desaulniers
2018-09-14 21:08 ` Segher Boessenkool
2018-09-17 20:41 ` Nick Desaulniers
2018-09-18 1:08 ` Joel Stanley
2018-09-18 10:53 ` Michael Ellerman
2018-09-14 4:06 ` [PATCH v2 3/5] powerpc/boot: Ensure _zimage_start is a weak symbol Joel Stanley
2018-09-14 17:50 ` Nick Desaulniers
2018-09-20 4:21 ` [v2,3/5] " Michael Ellerman
2018-09-14 4:06 ` Joel Stanley [this message]
2018-09-14 17:57 ` [PATCH v2 4/5] powerpc: Fix duplicate const clang warning in user access code Nick Desaulniers
2018-09-19 7:45 ` Joel Stanley
2018-09-20 4:54 ` Christophe LEROY
2018-09-20 12:35 ` Michael Ellerman
2018-09-20 4:21 ` [v2, " Michael Ellerman
2018-09-14 4:06 ` [PATCH v2 5/5] powerpc: Remove -mno-sched-epilog Joel Stanley
2018-09-14 5:06 ` Nicholas Piggin
2018-09-14 18:03 ` Nick Desaulniers
2018-09-14 20:43 ` Nicholas Piggin
2018-09-14 21:18 ` Segher Boessenkool
2018-09-14 22:20 ` Nick Desaulniers
2018-09-15 1:04 ` Segher Boessenkool
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180914040649.1794-5-joel@jms.id.au \
--to=joel@jms.id.au \
--cc=anton@ozlabs.org \
--cc=anton@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).