linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] x86: fix sparse warnings
@ 2012-09-02 21:31 Mathias Krause
  2012-09-02 21:31 ` [PATCH 1/7] x86: fix __user annotations in asm/sys_ia32.h Mathias Krause
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause

This series fixes sparse warnings below arch/x86/ -- mostly address space
related, e.g. missing __user or __iomem annotations. Also minor C style
issues were fixed (duplicated const keyword; 0 instead of NULL).

All of these make spare complain less for code in arch/x86/.

Please apply!

Regards,

Mathias Krause (7):
  x86: fix __user annotations in asm/sys_ia32.h
  x86, vdso: add __user annotation to VDSO32_SYMBOL
  x86: ia32_signal.c: add __user casts to fix sparse warnings
  x86, probe_roms: add missing __iomem annotation to pci_map_biosrom()
  x86, xsave: keep __user annotation in casts
  x86, iommu: drop duplicate const in __IOMMU_INIT
  x86, iommu: use NULL instead of plain 0 for __IOMMU_INIT

 arch/x86/ia32/ia32_signal.c        |   11 ++++++-----
 arch/x86/ia32/sys_ia32.c           |    2 +-
 arch/x86/include/asm/iommu_table.h |    6 +++---
 arch/x86/include/asm/sys_ia32.h    |    2 +-
 arch/x86/include/asm/vdso.h        |    3 ++-
 arch/x86/kernel/probe_roms.c       |    2 +-
 arch/x86/kernel/xsave.c            |    6 +++---
 7 files changed, 17 insertions(+), 15 deletions(-)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] x86: fix __user annotations in asm/sys_ia32.h
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 10:54   ` [tip:x86/debug] x86: Fix " tip-bot for Mathias Krause
  2012-09-02 21:31 ` [PATCH 2/7] x86, vdso: add __user annotation to VDSO32_SYMBOL Mathias Krause
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause, Jaswinder Singh Rajput

Fix the following sparse warning:

sys_ia32.c:293:38: warning: incorrect type in argument 2 (different address spaces)
sys_ia32.c:293:38:    expected unsigned int [noderef] [usertype] <asn:1>*stat_addr
sys_ia32.c:293:38:    got unsigned int *stat_addr

Ironically, sys_ia32.h was introduced to fix sparse warnings but missed that
one.

Cc: Jaswinder Singh Rajput <jaswinder@infradead.org>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/ia32/sys_ia32.c        |    2 +-
 arch/x86/include/asm/sys_ia32.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 4540bec..c5b938d 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -287,7 +287,7 @@ asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
 	return ret;
 }
 
-asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr,
+asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr,
 			      int options)
 {
 	return compat_sys_wait4(pid, stat_addr, options, NULL);
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 3fda9db4..4ca1c61 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -40,7 +40,7 @@ asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *,
 				struct old_sigaction32 __user *);
 asmlinkage long sys32_alarm(unsigned int);
 
-asmlinkage long sys32_waitpid(compat_pid_t, unsigned int *, int);
+asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int);
 asmlinkage long sys32_sysfs(int, u32, u32);
 
 asmlinkage long sys32_sched_rr_get_interval(compat_pid_t,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/7] x86, vdso: add __user annotation to VDSO32_SYMBOL
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
  2012-09-02 21:31 ` [PATCH 1/7] x86: fix __user annotations in asm/sys_ia32.h Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 10:55   ` [tip:x86/debug] x86/vdso: Add " tip-bot for Mathias Krause
  2012-09-02 21:31 ` [PATCH 3/7] x86: ia32_signal.c: add __user casts to fix sparse warnings Mathias Krause
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause

The address calculated by VDSO32_SYMBOL() is a pointer into userland.
Add the __user annotation to fix related sparse warnings in its users.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/include/asm/vdso.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
index bb05228..fddb53d 100644
--- a/arch/x86/include/asm/vdso.h
+++ b/arch/x86/include/asm/vdso.h
@@ -11,7 +11,8 @@ extern const char VDSO32_PRELINK[];
 #define VDSO32_SYMBOL(base, name)					\
 ({									\
 	extern const char VDSO32_##name[];				\
-	(void *)(VDSO32_##name - VDSO32_PRELINK + (unsigned long)(base)); \
+	(void __user *)(VDSO32_##name - VDSO32_PRELINK +		\
+			(unsigned long)(base));				\
 })
 #endif
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/7] x86: ia32_signal.c: add __user casts to fix sparse warnings
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
  2012-09-02 21:31 ` [PATCH 1/7] x86: fix __user annotations in asm/sys_ia32.h Mathias Krause
  2012-09-02 21:31 ` [PATCH 2/7] x86, vdso: add __user annotation to VDSO32_SYMBOL Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 10:56   ` [tip:x86/debug] x86/signals: " tip-bot for Mathias Krause
  2012-09-02 21:31 ` [PATCH 4/7] x86, probe_roms: add missing __iomem annotation to pci_map_biosrom() Mathias Krause
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause

Fix the following sparse warnings by adding appropriate __user casts and
annotations:

ia32_signal.c:165:38: warning: incorrect type in argument 1 (different address spaces)
ia32_signal.c:165:38:    expected struct sigaltstack const [noderef] [usertype] <asn:1>*<noident>
ia32_signal.c:165:38:    got struct sigaltstack *
ia32_signal.c:165:54: warning: incorrect type in argument 2 (different address spaces)
ia32_signal.c:165:54:    expected struct sigaltstack [noderef] [usertype] <asn:1>*<noident>
ia32_signal.c:165:54:    got struct sigaltstack *<noident>
ia32_signal.c:386:43: warning: incorrect type in argument 1 (different address spaces)
ia32_signal.c:386:43:    expected void [noderef] <asn:1>*buf
ia32_signal.c:386:43:    got void *<noident>
ia32_signal.c:416:57: warning: incorrect type in argument 4 (different address spaces)
ia32_signal.c:416:57:    expected void **fpstate
ia32_signal.c:416:57:    got void [noderef] <asn:1>**<noident>
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: incorrect type in argument 1 (different address spaces)
ia32_signal.c:451:17:    expected void const volatile [noderef] <asn:1>*<noident>
ia32_signal.c:451:17:    got unsigned long long [usertype] *<noident>
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:451:17: warning: cast removes address space of expression
ia32_signal.c:496:57: warning: incorrect type in argument 4 (different address spaces)
ia32_signal.c:496:57:    expected void **fpstate
ia32_signal.c:496:57:    got void [noderef] <asn:1>**<noident>
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: incorrect type in argument 1 (different address spaces)
ia32_signal.c:532:17:    expected void const volatile [noderef] <asn:1>*<noident>
ia32_signal.c:532:17:    got unsigned long long [usertype] *<noident>
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression
ia32_signal.c:532:17: warning: cast removes address space of expression

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/ia32/ia32_signal.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 673ac9b..452d4dd 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -162,7 +162,8 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
 	}
 	seg = get_fs();
 	set_fs(KERNEL_DS);
-	ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp);
+	ret = do_sigaltstack((stack_t __force __user *) (uss_ptr ? &uss : NULL),
+			     (stack_t __force __user *) &uoss, regs->sp);
 	set_fs(seg);
 	if (ret >= 0 && uoss_ptr)  {
 		if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)))
@@ -361,7 +362,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
  */
 static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 				 size_t frame_size,
-				 void **fpstate)
+				 void __user **fpstate)
 {
 	unsigned long sp;
 
@@ -382,7 +383,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 
 	if (used_math()) {
 		sp = sp - sig_xstate_ia32_size;
-		*fpstate = (struct _fpstate_ia32 *) sp;
+		*fpstate = (struct _fpstate_ia32 __user *) sp;
 		if (save_i387_xstate_ia32(*fpstate) < 0)
 			return (void __user *) -1L;
 	}
@@ -448,7 +449,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
 		 * These are actually not used anymore, but left because some
 		 * gdb versions depend on them as a marker.
 		 */
-		put_user_ex(*((u64 *)&code), (u64 *)frame->retcode);
+		put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
 	} put_user_catch(err);
 
 	if (err)
@@ -529,7 +530,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 		 * Not actually used anymore, but left because some gdb
 		 * versions need it.
 		 */
-		put_user_ex(*((u64 *)&code), (u64 *)frame->retcode);
+		put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
 	} put_user_catch(err);
 
 	if (err)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] x86, probe_roms: add missing __iomem annotation to pci_map_biosrom()
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
                   ` (2 preceding siblings ...)
  2012-09-02 21:31 ` [PATCH 3/7] x86: ia32_signal.c: add __user casts to fix sparse warnings Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 10:57   ` [tip:x86/debug] x86/pci/probe_roms: Add " tip-bot for Mathias Krause
  2012-09-02 21:31 ` [PATCH 5/7] x86, xsave: keep __user annotation in casts Mathias Krause
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause, Dan Williams

Stay in sync with the declaration and fix the corresponding sparse
warnings.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/kernel/probe_roms.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/probe_roms.c b/arch/x86/kernel/probe_roms.c
index 0bc72e2..d5f15c3 100644
--- a/arch/x86/kernel/probe_roms.c
+++ b/arch/x86/kernel/probe_roms.c
@@ -150,7 +150,7 @@ static struct resource *find_oprom(struct pci_dev *pdev)
 	return oprom;
 }
 
-void *pci_map_biosrom(struct pci_dev *pdev)
+void __iomem *pci_map_biosrom(struct pci_dev *pdev)
 {
 	struct resource *oprom = find_oprom(pdev);
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/7] x86, xsave: keep __user annotation in casts
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
                   ` (3 preceding siblings ...)
  2012-09-02 21:31 ` [PATCH 4/7] x86, probe_roms: add missing __iomem annotation to pci_map_biosrom() Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 10:58   ` [tip:x86/debug] x86/fpu/xsave: Keep " tip-bot for Mathias Krause
  2012-09-02 21:31 ` [PATCH 6/7] x86, iommu: drop duplicate const in __IOMMU_INIT Mathias Krause
  2012-09-02 21:31 ` [PATCH 7/7] x86, iommu: use NULL instead of plain 0 for __IOMMU_INIT Mathias Krause
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause

Don't remove the __user annotation of the fpstate pointer, but drop the
superfluous void * cast instead.

This fixes the following sparse warnings:

xsave.c:135:15: warning: cast removes address space of expression
xsave.c:135:15: warning: incorrect type in argument 1 (different address spaces)
xsave.c:135:15:    expected void const volatile [noderef] <asn:1>*<noident>
xsave.c:135:15:    got unsigned int [usertype] *<noident>
xsave.c:135:15: warning: cast removes address space of expression
xsave.c:135:15: warning: cast removes address space of expression
xsave.c:135:15: warning: cast removes address space of expression
xsave.c:135:15: warning: cast removes address space of expression
xsave.c:135:15: warning: cast removes address space of expression
xsave.c:135:15: warning: cast removes address space of expression

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/kernel/xsave.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 3d3e207..9e1a8a7 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -132,9 +132,9 @@ int check_for_xstate(struct i387_fxsave_struct __user *buf,
 	    fx_sw_user->xstate_size > fx_sw_user->extended_size)
 		return -EINVAL;
 
-	err = __get_user(magic2, (__u32 *) (((void *)fpstate) +
-					    fx_sw_user->extended_size -
-					    FP_XSTATE_MAGIC2_SIZE));
+	err = __get_user(magic2, (__u32 __user *) (fpstate +
+						   fx_sw_user->extended_size -
+						   FP_XSTATE_MAGIC2_SIZE));
 	if (err)
 		return err;
 	/*
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 6/7] x86, iommu: drop duplicate const in __IOMMU_INIT
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
                   ` (4 preceding siblings ...)
  2012-09-02 21:31 ` [PATCH 5/7] x86, xsave: keep __user annotation in casts Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 10:59   ` [tip:x86/debug] x86/iommu: Drop " tip-bot for Mathias Krause
  2012-09-02 21:31 ` [PATCH 7/7] x86, iommu: use NULL instead of plain 0 for __IOMMU_INIT Mathias Krause
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause

It's redundant and makes sparse complain about it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/include/asm/iommu_table.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h
index f229b13..bbf8fb2 100644
--- a/arch/x86/include/asm/iommu_table.h
+++ b/arch/x86/include/asm/iommu_table.h
@@ -48,7 +48,7 @@ struct iommu_table_entry {
 
 
 #define __IOMMU_INIT(_detect, _depend, _early_init, _late_init, _finish)\
-	static const struct iommu_table_entry const			\
+	static const struct iommu_table_entry				\
 		__iommu_entry_##_detect __used				\
 	__attribute__ ((unused, __section__(".iommu_table"),		\
 			aligned((sizeof(void *)))))	\
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] x86, iommu: use NULL instead of plain 0 for __IOMMU_INIT
  2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
                   ` (5 preceding siblings ...)
  2012-09-02 21:31 ` [PATCH 6/7] x86, iommu: drop duplicate const in __IOMMU_INIT Mathias Krause
@ 2012-09-02 21:31 ` Mathias Krause
  2012-09-05 11:00   ` [tip:x86/debug] x86/iommu: Use " tip-bot for Mathias Krause
  6 siblings, 1 reply; 15+ messages in thread
From: Mathias Krause @ 2012-09-02 21:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Mathias Krause

IOMMU_INIT_POST and IOMMU_INIT_POST_FINISH pass the plain value 0
instead of NULL to __IOMMU_INIT. Fix this and make sparse happy by
doing so.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/include/asm/iommu_table.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h
index bbf8fb2..f42a047 100644
--- a/arch/x86/include/asm/iommu_table.h
+++ b/arch/x86/include/asm/iommu_table.h
@@ -63,10 +63,10 @@ struct iommu_table_entry {
  * to stop detecting the other IOMMUs after yours has been detected.
  */
 #define IOMMU_INIT_POST(_detect)					\
-	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  0, 0, 0)
+	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  NULL, NULL, 0)
 
 #define IOMMU_INIT_POST_FINISH(detect)					\
-	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  0, 0, 1)
+	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  NULL, NULL, 1)
 
 /*
  * A more sophisticated version of IOMMU_INIT. This variant requires:
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86: Fix __user annotations in asm/sys_ia32.h
  2012-09-02 21:31 ` [PATCH 1/7] x86: fix __user annotations in asm/sys_ia32.h Mathias Krause
@ 2012-09-05 10:54   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 10:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, minipli, tglx

Commit-ID:  f00026276ace77dcad1cdf17f696ae4e56e12ee6
Gitweb:     http://git.kernel.org/tip/f00026276ace77dcad1cdf17f696ae4e56e12ee6
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:40 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:23 +0200

x86: Fix __user annotations in asm/sys_ia32.h

Fix the following sparse warnings:

  sys_ia32.c:293:38: warning: incorrect type in argument 2 (different address spaces)
  sys_ia32.c:293:38:    expected unsigned int [noderef] [usertype] <asn:1>*stat_addr
  sys_ia32.c:293:38:    got unsigned int *stat_addr

Ironically, sys_ia32.h was introduced to fix sparse warnings but
missed that one.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Link: http://lkml.kernel.org/r/1346621506-30857-2-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/ia32/sys_ia32.c        |    2 +-
 arch/x86/include/asm/sys_ia32.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 4540bec..c5b938d 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -287,7 +287,7 @@ asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
 	return ret;
 }
 
-asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr,
+asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr,
 			      int options)
 {
 	return compat_sys_wait4(pid, stat_addr, options, NULL);
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 3fda9db4..4ca1c61 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -40,7 +40,7 @@ asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *,
 				struct old_sigaction32 __user *);
 asmlinkage long sys32_alarm(unsigned int);
 
-asmlinkage long sys32_waitpid(compat_pid_t, unsigned int *, int);
+asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int);
 asmlinkage long sys32_sysfs(int, u32, u32);
 
 asmlinkage long sys32_sched_rr_get_interval(compat_pid_t,

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86/vdso: Add __user annotation to VDSO32_SYMBOL
  2012-09-02 21:31 ` [PATCH 2/7] x86, vdso: add __user annotation to VDSO32_SYMBOL Mathias Krause
@ 2012-09-05 10:55   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 10:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, minipli, tglx, luto

Commit-ID:  3d1334064fb365ea8f299874c2b4c46de2bee74d
Gitweb:     http://git.kernel.org/tip/3d1334064fb365ea8f299874c2b4c46de2bee74d
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:41 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:23 +0200

x86/vdso: Add __user annotation to VDSO32_SYMBOL

The address calculated by VDSO32_SYMBOL() is a pointer into
userland. Add the __user annotation to fix related sparse
warnings in its users.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Andy Lutomirski <luto@MIT.EDU>
Link: http://lkml.kernel.org/r/1346621506-30857-3-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/vdso.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
index bb05228..fddb53d 100644
--- a/arch/x86/include/asm/vdso.h
+++ b/arch/x86/include/asm/vdso.h
@@ -11,7 +11,8 @@ extern const char VDSO32_PRELINK[];
 #define VDSO32_SYMBOL(base, name)					\
 ({									\
 	extern const char VDSO32_##name[];				\
-	(void *)(VDSO32_##name - VDSO32_PRELINK + (unsigned long)(base)); \
+	(void __user *)(VDSO32_##name - VDSO32_PRELINK +		\
+			(unsigned long)(base));				\
 })
 #endif
 

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86/signals: ia32_signal.c: add __user casts to fix sparse warnings
  2012-09-02 21:31 ` [PATCH 3/7] x86: ia32_signal.c: add __user casts to fix sparse warnings Mathias Krause
@ 2012-09-05 10:56   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 10:56 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, minipli, oleg, tglx

Commit-ID:  0ff8fef4eaf252ee13a2d0b175a8c876415bd62a
Gitweb:     http://git.kernel.org/tip/0ff8fef4eaf252ee13a2d0b175a8c876415bd62a
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:42 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:24 +0200

x86/signals: ia32_signal.c: add __user casts to fix sparse warnings

Fix the following sparse warnings by adding appropriate __user
casts and annotations:

  ia32_signal.c:165:38: warning: incorrect type in argument 1 (different address spaces)
   ia32_signal.c:165:38:    expected struct sigaltstack const [noderef] [usertype] <asn:1>*<noident>
  ia32_signal.c:165:38:    got struct sigaltstack *
  [...]

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/1346621506-30857-4-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/ia32/ia32_signal.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 673ac9b..452d4dd 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -162,7 +162,8 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
 	}
 	seg = get_fs();
 	set_fs(KERNEL_DS);
-	ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp);
+	ret = do_sigaltstack((stack_t __force __user *) (uss_ptr ? &uss : NULL),
+			     (stack_t __force __user *) &uoss, regs->sp);
 	set_fs(seg);
 	if (ret >= 0 && uoss_ptr)  {
 		if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)))
@@ -361,7 +362,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
  */
 static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 				 size_t frame_size,
-				 void **fpstate)
+				 void __user **fpstate)
 {
 	unsigned long sp;
 
@@ -382,7 +383,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 
 	if (used_math()) {
 		sp = sp - sig_xstate_ia32_size;
-		*fpstate = (struct _fpstate_ia32 *) sp;
+		*fpstate = (struct _fpstate_ia32 __user *) sp;
 		if (save_i387_xstate_ia32(*fpstate) < 0)
 			return (void __user *) -1L;
 	}
@@ -448,7 +449,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
 		 * These are actually not used anymore, but left because some
 		 * gdb versions depend on them as a marker.
 		 */
-		put_user_ex(*((u64 *)&code), (u64 *)frame->retcode);
+		put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
 	} put_user_catch(err);
 
 	if (err)
@@ -529,7 +530,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 		 * Not actually used anymore, but left because some gdb
 		 * versions need it.
 		 */
-		put_user_ex(*((u64 *)&code), (u64 *)frame->retcode);
+		put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
 	} put_user_catch(err);
 
 	if (err)

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86/pci/probe_roms: Add missing __iomem annotation to pci_map_biosrom()
  2012-09-02 21:31 ` [PATCH 4/7] x86, probe_roms: add missing __iomem annotation to pci_map_biosrom() Mathias Krause
@ 2012-09-05 10:57   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 10:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, dan.j.williams, minipli, tglx

Commit-ID:  04d695a6828bca54d53305246545cd1f8a841ac6
Gitweb:     http://git.kernel.org/tip/04d695a6828bca54d53305246545cd1f8a841ac6
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:43 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:25 +0200

x86/pci/probe_roms: Add missing __iomem annotation to pci_map_biosrom()

Stay in sync with the declaration and fix the corresponding
sparse warnings.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Link: http://lkml.kernel.org/r/1346621506-30857-5-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/probe_roms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/probe_roms.c b/arch/x86/kernel/probe_roms.c
index 0bc72e2..d5f15c3 100644
--- a/arch/x86/kernel/probe_roms.c
+++ b/arch/x86/kernel/probe_roms.c
@@ -150,7 +150,7 @@ static struct resource *find_oprom(struct pci_dev *pdev)
 	return oprom;
 }
 
-void *pci_map_biosrom(struct pci_dev *pdev)
+void __iomem *pci_map_biosrom(struct pci_dev *pdev)
 {
 	struct resource *oprom = find_oprom(pdev);
 

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86/fpu/xsave: Keep __user annotation in casts
  2012-09-02 21:31 ` [PATCH 5/7] x86, xsave: keep __user annotation in casts Mathias Krause
@ 2012-09-05 10:58   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 10:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, minipli, suresh.b.siddha, tglx

Commit-ID:  5c7d03e99cb1ed449328ed9fba0c632944d39e7e
Gitweb:     http://git.kernel.org/tip/5c7d03e99cb1ed449328ed9fba0c632944d39e7e
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:44 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:25 +0200

x86/fpu/xsave: Keep __user annotation in casts

Don't remove the __user annotation of the fpstate pointer, but
drop the superfluous void * cast instead.

This fixes the following sparse warnings:

  xsave.c:135:15: warning: cast removes address space of expression
  xsave.c:135:15: warning: incorrect type in argument 1 (different address spaces)
  xsave.c:135:15:    expected void const volatile [noderef] <asn:1>*<noident>
  [...]

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1346621506-30857-6-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/xsave.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 3d3e207..9e1a8a7 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -132,9 +132,9 @@ int check_for_xstate(struct i387_fxsave_struct __user *buf,
 	    fx_sw_user->xstate_size > fx_sw_user->extended_size)
 		return -EINVAL;
 
-	err = __get_user(magic2, (__u32 *) (((void *)fpstate) +
-					    fx_sw_user->extended_size -
-					    FP_XSTATE_MAGIC2_SIZE));
+	err = __get_user(magic2, (__u32 __user *) (fpstate +
+						   fx_sw_user->extended_size -
+						   FP_XSTATE_MAGIC2_SIZE));
 	if (err)
 		return err;
 	/*

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86/iommu: Drop duplicate const in __IOMMU_INIT
  2012-09-02 21:31 ` [PATCH 6/7] x86, iommu: drop duplicate const in __IOMMU_INIT Mathias Krause
@ 2012-09-05 10:59   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 10:59 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, joerg.roedel, minipli, tglx

Commit-ID:  2b11afd1ab502d959ae8d6d5812923151b5bc505
Gitweb:     http://git.kernel.org/tip/2b11afd1ab502d959ae8d6d5812923151b5bc505
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:45 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:26 +0200

x86/iommu: Drop duplicate const in __IOMMU_INIT

It's redundant and makes sparse complain about it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Link: http://lkml.kernel.org/r/1346621506-30857-7-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/iommu_table.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h
index f229b13..bbf8fb2 100644
--- a/arch/x86/include/asm/iommu_table.h
+++ b/arch/x86/include/asm/iommu_table.h
@@ -48,7 +48,7 @@ struct iommu_table_entry {
 
 
 #define __IOMMU_INIT(_detect, _depend, _early_init, _late_init, _finish)\
-	static const struct iommu_table_entry const			\
+	static const struct iommu_table_entry				\
 		__iommu_entry_##_detect __used				\
 	__attribute__ ((unused, __section__(".iommu_table"),		\
 			aligned((sizeof(void *)))))	\

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:x86/debug] x86/iommu: Use NULL instead of plain 0 for __IOMMU_INIT
  2012-09-02 21:31 ` [PATCH 7/7] x86, iommu: use NULL instead of plain 0 for __IOMMU_INIT Mathias Krause
@ 2012-09-05 11:00   ` tip-bot for Mathias Krause
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Mathias Krause @ 2012-09-05 11:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, joerg.roedel, minipli, tglx

Commit-ID:  ae13b7b4e041eccf34fa4dd58581fe1441375578
Gitweb:     http://git.kernel.org/tip/ae13b7b4e041eccf34fa4dd58581fe1441375578
Author:     Mathias Krause <minipli@googlemail.com>
AuthorDate: Sun, 2 Sep 2012 23:31:46 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 5 Sep 2012 10:52:26 +0200

x86/iommu: Use NULL instead of plain 0 for __IOMMU_INIT

IOMMU_INIT_POST and IOMMU_INIT_POST_FINISH pass the plain value
0 instead of NULL to __IOMMU_INIT. Fix this and make sparse
happy by doing so.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Link: http://lkml.kernel.org/r/1346621506-30857-8-git-send-email-minipli@googlemail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/iommu_table.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h
index bbf8fb2..f42a047 100644
--- a/arch/x86/include/asm/iommu_table.h
+++ b/arch/x86/include/asm/iommu_table.h
@@ -63,10 +63,10 @@ struct iommu_table_entry {
  * to stop detecting the other IOMMUs after yours has been detected.
  */
 #define IOMMU_INIT_POST(_detect)					\
-	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  0, 0, 0)
+	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  NULL, NULL, 0)
 
 #define IOMMU_INIT_POST_FINISH(detect)					\
-	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  0, 0, 1)
+	__IOMMU_INIT(_detect, pci_swiotlb_detect_4gb,  NULL, NULL, 1)
 
 /*
  * A more sophisticated version of IOMMU_INIT. This variant requires:

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-09-05 11:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-02 21:31 [PATCH 0/7] x86: fix sparse warnings Mathias Krause
2012-09-02 21:31 ` [PATCH 1/7] x86: fix __user annotations in asm/sys_ia32.h Mathias Krause
2012-09-05 10:54   ` [tip:x86/debug] x86: Fix " tip-bot for Mathias Krause
2012-09-02 21:31 ` [PATCH 2/7] x86, vdso: add __user annotation to VDSO32_SYMBOL Mathias Krause
2012-09-05 10:55   ` [tip:x86/debug] x86/vdso: Add " tip-bot for Mathias Krause
2012-09-02 21:31 ` [PATCH 3/7] x86: ia32_signal.c: add __user casts to fix sparse warnings Mathias Krause
2012-09-05 10:56   ` [tip:x86/debug] x86/signals: " tip-bot for Mathias Krause
2012-09-02 21:31 ` [PATCH 4/7] x86, probe_roms: add missing __iomem annotation to pci_map_biosrom() Mathias Krause
2012-09-05 10:57   ` [tip:x86/debug] x86/pci/probe_roms: Add " tip-bot for Mathias Krause
2012-09-02 21:31 ` [PATCH 5/7] x86, xsave: keep __user annotation in casts Mathias Krause
2012-09-05 10:58   ` [tip:x86/debug] x86/fpu/xsave: Keep " tip-bot for Mathias Krause
2012-09-02 21:31 ` [PATCH 6/7] x86, iommu: drop duplicate const in __IOMMU_INIT Mathias Krause
2012-09-05 10:59   ` [tip:x86/debug] x86/iommu: Drop " tip-bot for Mathias Krause
2012-09-02 21:31 ` [PATCH 7/7] x86, iommu: use NULL instead of plain 0 for __IOMMU_INIT Mathias Krause
2012-09-05 11:00   ` [tip:x86/debug] x86/iommu: Use " tip-bot for Mathias Krause

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).