linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Krause <minipli@googlemail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Mathias Krause <minipli@googlemail.com>
Subject: [PATCH 3/7] x86: ia32_signal.c: add __user casts to fix sparse warnings
Date: Sun,  2 Sep 2012 23:31:42 +0200	[thread overview]
Message-ID: <1346621506-30857-4-git-send-email-minipli@googlemail.com> (raw)
In-Reply-To: <1346621506-30857-1-git-send-email-minipli@googlemail.com>

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


  parent reply	other threads:[~2012-09-02 21:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Mathias Krause [this message]
2012-09-05 10:56   ` [tip:x86/debug] x86/signals: ia32_signal.c: add __user casts to fix sparse warnings 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

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=1346621506-30857-4-git-send-email-minipli@googlemail.com \
    --to=minipli@googlemail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).