From: Daniel Axtens <hidden> Date: 2017-01-30 06:42:13
Looking through the sparse warnings, I noticed that we were getting
warnings about dropping const qualifiers in get_user calls. This took
a while to figure out: it turns out that if you pass a const pointer
in, sparse will complain when we drop the const qualifier deep inside
the __get_user_ macros. This simple series fixes that, squashing over
60 warnings.
Daniel Axtens (3):
powerpc/sparse: constify the address pointer in __get_user_check
powerpc/sparse: constify the address pointer in __get_user_nocheck
powerpc/sparse: constify the address pointer in __get_user_nosleep
arch/powerpc/include/asm/uaccess.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
2.9.3
From: Daniel Axtens <hidden> Date: 2017-01-30 06:42:15
In __get_user_check, 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_check macro.
Signed-off-by: Daniel Axtens <redacted>
---
This fixes warnings outside arch/powerpc where people are passing
constified pointers into get_user(), such as:
linux/fs/exec.c:423:21: warning: incorrect type in initializer (different modifiers)
expected unsigned int [noderef] <asn:1>*__gu_addr
got unsigned int const [noderef] [usertype] <asn:1>*
linux/kernel/trace/trace.c:1219:15: warning: incorrect type in initializer (different modifiers)
expected char [noderef] <asn:1>*__gu_addr
got char const [noderef] <asn:1>*
A total of 14 warnings in my pseries build are squashed.
---
arch/powerpc/include/asm/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Daniel Axtens <hidden> Date: 2017-01-30 06:42:17
In __get_user_nocheck, 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_nocheck macro.
Signed-off-by: Daniel Axtens <redacted>
---
This squashes 52 sparse warnings in my pseries build. They're
similar to the ones squashed in the previous patch.
---
arch/powerpc/include/asm/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Daniel Axtens <hidden> Date: 2017-01-30 06:42:20
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 <redacted>
---
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(-)
From: Michael Ellerman <hidden> Date: 2017-02-02 11:45:14
On Mon, 2017-01-30 at 06:41:53 UTC, Daniel Axtens wrote:
In __get_user_check, 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_check macro.
Signed-off-by: Daniel Axtens <redacted>