diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-10-27 18:34:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:11 -0400 |
commit | f68d2048206389603d646b06e3cc16f1bbc3ff88 (patch) | |
tree | fd610c5c8ea6bce1324c1d1943fd4494b66e484a /arch/powerpc | |
parent | 1cb4953c608d01d8ea522e2cf379e5e90f06d7a3 (diff) |
ptrace: cleanup arch_ptrace() on powerpc
Use new 'datavp' and 'datalp' variables in order to remove unnecessary
castings.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/ptrace.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 136763568a7b..a9b32967cff6 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
@@ -1409,26 +1409,28 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data) | |||
1409 | static long arch_ptrace_old(struct task_struct *child, long request, | 1409 | static long arch_ptrace_old(struct task_struct *child, long request, |
1410 | unsigned long addr, unsigned long data) | 1410 | unsigned long addr, unsigned long data) |
1411 | { | 1411 | { |
1412 | void __user *datavp = (void __user *) data; | ||
1413 | |||
1412 | switch (request) { | 1414 | switch (request) { |
1413 | case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */ | 1415 | case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */ |
1414 | return copy_regset_to_user(child, &user_ppc_native_view, | 1416 | return copy_regset_to_user(child, &user_ppc_native_view, |
1415 | REGSET_GPR, 0, 32 * sizeof(long), | 1417 | REGSET_GPR, 0, 32 * sizeof(long), |
1416 | (void __user *) data); | 1418 | datavp); |
1417 | 1419 | ||
1418 | case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */ | 1420 | case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */ |
1419 | return copy_regset_from_user(child, &user_ppc_native_view, | 1421 | return copy_regset_from_user(child, &user_ppc_native_view, |
1420 | REGSET_GPR, 0, 32 * sizeof(long), | 1422 | REGSET_GPR, 0, 32 * sizeof(long), |
1421 | (const void __user *) data); | 1423 | datavp); |
1422 | 1424 | ||
1423 | case PPC_PTRACE_GETFPREGS: /* Get FPRs 0 - 31. */ | 1425 | case PPC_PTRACE_GETFPREGS: /* Get FPRs 0 - 31. */ |
1424 | return copy_regset_to_user(child, &user_ppc_native_view, | 1426 | return copy_regset_to_user(child, &user_ppc_native_view, |
1425 | REGSET_FPR, 0, 32 * sizeof(double), | 1427 | REGSET_FPR, 0, 32 * sizeof(double), |
1426 | (void __user *) data); | 1428 | datavp); |
1427 | 1429 | ||
1428 | case PPC_PTRACE_SETFPREGS: /* Set FPRs 0 - 31. */ | 1430 | case PPC_PTRACE_SETFPREGS: /* Set FPRs 0 - 31. */ |
1429 | return copy_regset_from_user(child, &user_ppc_native_view, | 1431 | return copy_regset_from_user(child, &user_ppc_native_view, |
1430 | REGSET_FPR, 0, 32 * sizeof(double), | 1432 | REGSET_FPR, 0, 32 * sizeof(double), |
1431 | (const void __user *) data); | 1433 | datavp); |
1432 | } | 1434 | } |
1433 | 1435 | ||
1434 | return -EPERM; | 1436 | return -EPERM; |
@@ -1438,6 +1440,8 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1438 | unsigned long addr, unsigned long data) | 1440 | unsigned long addr, unsigned long data) |
1439 | { | 1441 | { |
1440 | int ret = -EPERM; | 1442 | int ret = -EPERM; |
1443 | void __user *datavp = (void __user *) data; | ||
1444 | unsigned long __user *datalp = datavp; | ||
1441 | 1445 | ||
1442 | switch (request) { | 1446 | switch (request) { |
1443 | /* read the word at location addr in the USER area. */ | 1447 | /* read the word at location addr in the USER area. */ |
@@ -1464,7 +1468,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1464 | tmp = ((unsigned long *)child->thread.fpr) | 1468 | tmp = ((unsigned long *)child->thread.fpr) |
1465 | [TS_FPRWIDTH * (index - PT_FPR0)]; | 1469 | [TS_FPRWIDTH * (index - PT_FPR0)]; |
1466 | } | 1470 | } |
1467 | ret = put_user(tmp,(unsigned long __user *) data); | 1471 | ret = put_user(tmp, datalp); |
1468 | break; | 1472 | break; |
1469 | } | 1473 | } |
1470 | 1474 | ||
@@ -1526,11 +1530,11 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1526 | dbginfo.features = 0; | 1530 | dbginfo.features = 0; |
1527 | #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ | 1531 | #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ |
1528 | 1532 | ||
1529 | if (!access_ok(VERIFY_WRITE, data, | 1533 | if (!access_ok(VERIFY_WRITE, datavp, |
1530 | sizeof(struct ppc_debug_info))) | 1534 | sizeof(struct ppc_debug_info))) |
1531 | return -EFAULT; | 1535 | return -EFAULT; |
1532 | ret = __copy_to_user((struct ppc_debug_info __user *)data, | 1536 | ret = __copy_to_user(datavp, &dbginfo, |
1533 | &dbginfo, sizeof(struct ppc_debug_info)) ? | 1537 | sizeof(struct ppc_debug_info)) ? |
1534 | -EFAULT : 0; | 1538 | -EFAULT : 0; |
1535 | break; | 1539 | break; |
1536 | } | 1540 | } |
@@ -1538,11 +1542,10 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1538 | case PPC_PTRACE_SETHWDEBUG: { | 1542 | case PPC_PTRACE_SETHWDEBUG: { |
1539 | struct ppc_hw_breakpoint bp_info; | 1543 | struct ppc_hw_breakpoint bp_info; |
1540 | 1544 | ||
1541 | if (!access_ok(VERIFY_READ, data, | 1545 | if (!access_ok(VERIFY_READ, datavp, |
1542 | sizeof(struct ppc_hw_breakpoint))) | 1546 | sizeof(struct ppc_hw_breakpoint))) |
1543 | return -EFAULT; | 1547 | return -EFAULT; |
1544 | ret = __copy_from_user(&bp_info, | 1548 | ret = __copy_from_user(&bp_info, datavp, |
1545 | (struct ppc_hw_breakpoint __user *)data, | ||
1546 | sizeof(struct ppc_hw_breakpoint)) ? | 1549 | sizeof(struct ppc_hw_breakpoint)) ? |
1547 | -EFAULT : 0; | 1550 | -EFAULT : 0; |
1548 | if (!ret) | 1551 | if (!ret) |
@@ -1561,11 +1564,9 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1561 | if (addr > 0) | 1564 | if (addr > 0) |
1562 | break; | 1565 | break; |
1563 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | 1566 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS |
1564 | ret = put_user(child->thread.dac1, | 1567 | ret = put_user(child->thread.dac1, datalp); |
1565 | (unsigned long __user *)data); | ||
1566 | #else | 1568 | #else |
1567 | ret = put_user(child->thread.dabr, | 1569 | ret = put_user(child->thread.dabr, datalp); |
1568 | (unsigned long __user *)data); | ||
1569 | #endif | 1570 | #endif |
1570 | break; | 1571 | break; |
1571 | } | 1572 | } |
@@ -1581,7 +1582,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1581 | return copy_regset_to_user(child, &user_ppc_native_view, | 1582 | return copy_regset_to_user(child, &user_ppc_native_view, |
1582 | REGSET_GPR, | 1583 | REGSET_GPR, |
1583 | 0, sizeof(struct pt_regs), | 1584 | 0, sizeof(struct pt_regs), |
1584 | (void __user *) data); | 1585 | datavp); |
1585 | 1586 | ||
1586 | #ifdef CONFIG_PPC64 | 1587 | #ifdef CONFIG_PPC64 |
1587 | case PTRACE_SETREGS64: | 1588 | case PTRACE_SETREGS64: |
@@ -1590,19 +1591,19 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1590 | return copy_regset_from_user(child, &user_ppc_native_view, | 1591 | return copy_regset_from_user(child, &user_ppc_native_view, |
1591 | REGSET_GPR, | 1592 | REGSET_GPR, |
1592 | 0, sizeof(struct pt_regs), | 1593 | 0, sizeof(struct pt_regs), |
1593 | (const void __user *) data); | 1594 | datavp); |
1594 | 1595 | ||
1595 | case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */ | 1596 | case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */ |
1596 | return copy_regset_to_user(child, &user_ppc_native_view, | 1597 | return copy_regset_to_user(child, &user_ppc_native_view, |
1597 | REGSET_FPR, | 1598 | REGSET_FPR, |
1598 | 0, sizeof(elf_fpregset_t), | 1599 | 0, sizeof(elf_fpregset_t), |
1599 | (void __user *) data); | 1600 | datavp); |
1600 | 1601 | ||
1601 | case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */ | 1602 | case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */ |
1602 | return copy_regset_from_user(child, &user_ppc_native_view, | 1603 | return copy_regset_from_user(child, &user_ppc_native_view, |
1603 | REGSET_FPR, | 1604 | REGSET_FPR, |
1604 | 0, sizeof(elf_fpregset_t), | 1605 | 0, sizeof(elf_fpregset_t), |
1605 | (const void __user *) data); | 1606 | datavp); |
1606 | 1607 | ||
1607 | #ifdef CONFIG_ALTIVEC | 1608 | #ifdef CONFIG_ALTIVEC |
1608 | case PTRACE_GETVRREGS: | 1609 | case PTRACE_GETVRREGS: |
@@ -1610,40 +1611,40 @@ long arch_ptrace(struct task_struct *child, long request, | |||
1610 | REGSET_VMX, | 1611 | REGSET_VMX, |
1611 | 0, (33 * sizeof(vector128) + | 1612 | 0, (33 * sizeof(vector128) + |
1612 | sizeof(u32)), | 1613 | sizeof(u32)), |
1613 | (void __user *) data); | 1614 | datavp); |
1614 | 1615 | ||
1615 | case PTRACE_SETVRREGS: | 1616 | case PTRACE_SETVRREGS: |
1616 | return copy_regset_from_user(child, &user_ppc_native_view, | 1617 | return copy_regset_from_user(child, &user_ppc_native_view, |
1617 | REGSET_VMX, | 1618 | REGSET_VMX, |
1618 | 0, (33 * sizeof(vector128) + | 1619 | 0, (33 * sizeof(vector128) + |
1619 | sizeof(u32)), | 1620 | sizeof(u32)), |
1620 | (const void __user *) data); | 1621 | datavp); |
1621 | #endif | 1622 | #endif |
1622 | #ifdef CONFIG_VSX | 1623 | #ifdef CONFIG_VSX |
1623 | case PTRACE_GETVSRREGS: | 1624 | case PTRACE_GETVSRREGS: |
1624 | return copy_regset_to_user(child, &user_ppc_native_view, | 1625 | return copy_regset_to_user(child, &user_ppc_native_view, |
1625 | REGSET_VSX, | 1626 | REGSET_VSX, |
1626 | 0, 32 * sizeof(double), | 1627 | 0, 32 * sizeof(double), |
1627 | (void __user *) data); | 1628 | datavp); |
1628 | 1629 | ||
1629 | case PTRACE_SETVSRREGS: | 1630 | case PTRACE_SETVSRREGS: |
1630 | return copy_regset_from_user(child, &user_ppc_native_view, | 1631 | return copy_regset_from_user(child, &user_ppc_native_view, |
1631 | REGSET_VSX, | 1632 | REGSET_VSX, |
1632 | 0, 32 * sizeof(double), | 1633 | 0, 32 * sizeof(double), |
1633 | (const void __user *) data); | 1634 | datavp); |
1634 | #endif | 1635 | #endif |
1635 | #ifdef CONFIG_SPE | 1636 | #ifdef CONFIG_SPE |
1636 | case PTRACE_GETEVRREGS: | 1637 | case PTRACE_GETEVRREGS: |
1637 | /* Get the child spe register state. */ | 1638 | /* Get the child spe register state. */ |
1638 | return copy_regset_to_user(child, &user_ppc_native_view, | 1639 | return copy_regset_to_user(child, &user_ppc_native_view, |
1639 | REGSET_SPE, 0, 35 * sizeof(u32), | 1640 | REGSET_SPE, 0, 35 * sizeof(u32), |
1640 | (void __user *) data); | 1641 | datavp); |
1641 | 1642 | ||
1642 | case PTRACE_SETEVRREGS: | 1643 | case PTRACE_SETEVRREGS: |
1643 | /* Set the child spe register state. */ | 1644 | /* Set the child spe register state. */ |
1644 | return copy_regset_from_user(child, &user_ppc_native_view, | 1645 | return copy_regset_from_user(child, &user_ppc_native_view, |
1645 | REGSET_SPE, 0, 35 * sizeof(u32), | 1646 | REGSET_SPE, 0, 35 * sizeof(u32), |
1646 | (const void __user *) data); | 1647 | datavp); |
1647 | #endif | 1648 | #endif |
1648 | 1649 | ||
1649 | /* Old reverse args ptrace callss */ | 1650 | /* Old reverse args ptrace callss */ |