From: Daniel Axtens <dja@axtens•net>
To: linuxppc-dev@lists•ozlabs.org
Cc: Daniel Axtens <dja@axtens•net>
Subject: [PATCH 3/3] powerpc/sparse: constify the address pointer in __get_user_nosleep
Date: Mon, 30 Jan 2017 17:41:55 +1100 [thread overview]
Message-ID: <20170130064155.30281-4-dja@axtens.net> (raw)
In-Reply-To: <20170130064155.30281-1-dja@axtens.net>
In __get_user_nosleep, we create an intermediate pointer for the
user address we're about to fetch. We currently don't tag this
pointer as const. Make it const, as we are simply dereferencing
it, and it's scope is limited to the __get_user_nosleep macro.
Signed-off-by: Daniel Axtens <dja@axtens•net>
---
This is sparse neutral:
-arch/powerpc/kernel/hw_breakpoint.c:XX:14: warning: incorrect type in initializer (different address spaces)
- expected unsigned int [noderef] <asn:1>*__gu_addr
- got unsigned int *<noident>
+arch/powerpc/kernel/hw_breakpoint.c:XX:14: warning: incorrect type in initializer (different address spaces)
+ expected unsigned int const [noderef] <asn:1>*__gu_addr
+ got unsigned int *<noident>
It looks like a pointer not tagged with __user is being passed in.
That will need to be fixed in a follow-up patch.
However this is still worth doing, as it makes the __get_user_*
macros consistent.
---
arch/powerpc/include/asm/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 44ded4193001..0e6add3187bc 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -286,7 +286,7 @@ do { \
({ \
long __gu_err; \
unsigned long __gu_val; \
- __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
+ const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
__chk_user_ptr(ptr); \
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
(x) = (__force __typeof__(*(ptr)))__gu_val; \
--
2.9.3
prev parent reply other threads:[~2017-01-30 6:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 6:41 [PATCH 0/3] powerpc/sparse: constify addresses in get_user macros Daniel Axtens
2017-01-30 6:41 ` [PATCH 1/3] powerpc/sparse: constify the address pointer in __get_user_check Daniel Axtens
2017-02-02 11:45 ` [1/3] " Michael Ellerman
2017-01-30 6:41 ` [PATCH 2/3] powerpc/sparse: constify the address pointer in __get_user_nocheck Daniel Axtens
2017-01-30 6:41 ` Daniel Axtens [this message]
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=20170130064155.30281-4-dja@axtens.net \
--to=dja@axtens$(echo .)net \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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