arch: tile: kernel: signal.c: Use __copy_from/to_user() instead of __get/put_user()
authorChen Gang <gang.chen.5i5j@gmail.com>
Sun, 2 Nov 2014 02:13:11 +0000 (10:13 +0800)
committerChris Metcalf <cmetcalf@tilera.com>
Tue, 4 Nov 2014 15:38:10 +0000 (10:38 -0500)
commit01f7ae056916b4e75ccaa48b9daacb9806caf4aa
tree9cf1b797c508389f465b9663eb60c0f5d2a7a8b9
parent0df1f2487d2f0d04703f142813d53615d62a1da4
arch: tile: kernel: signal.c: Use __copy_from/to_user() instead of __get/put_user()

setup/restore_sigcontext() want to copy all related registers between
user and kernel. So use block copy instead of each registers copy. Then
can let code simple and clearer (which can avoid compiler's warning):

The related warning (with allmodconfig under tile):

    CC      arch/tile/kernel/signal.o
  In file included from include/linux/poll.h:11:0,
                   from include/linux/ring_buffer.h:7,
                   from include/linux/ftrace_event.h:5,
                   from include/trace/syscall.h:6,
                   from include/linux/syscalls.h:81,
                   from arch/tile/kernel/signal.c:30:
  arch/tile/kernel/signal.c: In function 'setup_sigcontext':
  arch/tile/kernel/signal.c:116:31: warning: iteration 53u invokes undefined behavior [-Waggressive-loop-optimizations]
     err |= __put_user(regs->regs[i], &sc->gregs[i]);
                                 ^
  ./arch/tile/include/asm/uaccess.h:236:26: note: in definition of macro '__put_user_asm'
          : "r" (ptr), "r" (x), "i" (-EFAULT))
                            ^
  ./arch/tile/include/asm/uaccess.h:297:10: note: in expansion of macro '__put_user_8'
    case 8: __put_user_8(x, ptr, __ret); break;   \
            ^
  arch/tile/kernel/signal.c:116:10: note: in expansion of macro '__put_user'
     err |= __put_user(regs->regs[i], &sc->gregs[i]);
            ^
  arch/tile/kernel/signal.c:115:2: note: containing loop
    for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i)
    ^

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
arch/tile/kernel/signal.c