| To: | ralf@linux-mips.org |
|---|---|
| Subject: | [PATCH 3/3] signal.c: fix gcc warning on 32 bits kernel |
| From: | Franck Bui-Huu <vagabon.xyz@gmail.com> |
| Date: | Fri, 9 Feb 2007 16:07:38 +0100 |
| Cc: | linux-mips@linux-mips.org, anemo@mba.ocn.ne.jp, Franck Bui-Huu <fbuihuu@gmail.com> |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:to:cc:subject:date:message-id:x-mailer:in-reply-to:references:from; b=EpKEZKzApItiYyEeQxtHFvtW9ZzyopOa7K2EUJHrq6dVatBT1M/4ytMRxYK61kl6fgabURU4t3BM7VLG/+SqlxsQ+lpvT8aHNdsEVVMHvwG2si5dhys15F8qahTLxqZ5APsOkBHU/UWCNaRGrZ5cvc171/tnyC3eInltaXM67Kc= |
| In-reply-to: | <1171033658561-git-send-email-fbuihuu@gmail.com> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <1171033658561-git-send-email-fbuihuu@gmail.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
From: Franck Bui-Huu <fbuihuu@gmail.com>
This hack prevents gcc to produce the following warning:
CC arch/mips/kernel/signal.o
arch/mips/kernel/signal.c: In function `sys_sigaction':
arch/mips/kernel/signal.c:266: warning: cast to pointer from integer of
different size
This warning is due to the following line:
__get_user(new_ka.sa.sa_handler, &act->sa_handler);
Indeed when __get_user() is expanded it produces the following
code:
switch (sizeof(*(&act->sa_handler))) {
... [snip] ...
case 8: {
unsigned long long __gu_tmp;
__asm__ __volatile__(
"1: lw %1, (%3) \n"
"2: lw %D1, 4(%3) \n"
" move %0, $0 \n"
"3: .section .fixup,\"ax\" \n"
"4: li %0, %4 \n"
" move %1, $0 \n"
" move %D1, $0 \n"
" j 3b \n"
" .previous \n"
" .section __ex_table,\"a\" \n"
" " ".word" " 1b, 4b \n"
" " ".word" " 2b, 4b \n"
" .previous \n"
: "=r" (__gu_err), "=&r" (__gu_tmp)
: "0" (0), "r" ((&act->sa_handler)), "i" (-14));
(((new_ka.sa.sa_handler))) =
(__typeof__(*((&act->sa_handler)))) __gu_tmp;
};
break;
default:
__get_user_unknown();
break;
}
which actually try to do:
new_ka.sa.sa_handler = (__sighandler_t) __gu_tmp;
Here we try to cast an 'unsigned long long' into a 32 bits pointer and
that's the reason of the warning.
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
arch/mips/kernel/signal.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index a3c04d0..ac8a05a 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -260,15 +260,17 @@ asmlinkage int sys_sigaction(int sig, const struct
sigaction __user *act,
if (act) {
old_sigset_t mask;
+ unsigned long tmp; /* fix a gcc warning */
if (!access_ok(VERIFY_READ, act, sizeof(*act)))
return -EFAULT;
- err |= __get_user(new_ka.sa.sa_handler, &act->sa_handler);
+ err |= __get_user(tmp, (unsigned long *)&act->sa_handler);
err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
err |= __get_user(mask, &act->sa_mask.sig[0]);
if (err)
return -EFAULT;
+ new_ka.sa.sa_handler = (__sighandler_t)tmp;
siginitset(&new_ka.sa.sa_mask, mask);
}
--
1.4.4.3.ge6d4
|
| Previous by Date: | [PATCH 1/3] signal: avoid useless test in do_signal(), Franck Bui-Huu |
|---|---|
| Next by Date: | [PATCH 0/3] More signal clean up, Franck Bui-Huu |
| Previous by Thread: | Re: [PATCH 1/3] signal: avoid useless test in do_signal(), Franck Bui-Huu |
| Next by Thread: | Re: [PATCH 3/3] signal.c: fix gcc warning on 32 bits kernel, Atsushi Nemoto |
| Indexes: | [Date] [Thread] [Top] [All Lists] |