]> granicus.if.org Git - strace/commitdiff
Fix casts of ptrace's third argument
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 26 Jul 2016 15:59:28 +0000 (15:59 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 26 Jul 2016 16:14:50 +0000 (16:14 +0000)
* strace.c (maybe_allocate_tcb): Replace "(char *) 0" with NULL
as ptrace's third argument.
* linux/sparc64/get_scno.c (arch_get_scno): Cast third argument
of ptrace to "void *'.
* syscall.c (get_regs): Likewise.
* upeek.c (upeek): Likewise.
* util.c (umoven): Likewise.

linux/sparc64/get_scno.c
strace.c
syscall.c
upeek.c
util.c

index 32384e6986238fb47cb3f3b2c3d88006f663bb7a..68d5917d380a11aa4af7d0cbcca8bf3466874659 100644 (file)
@@ -5,7 +5,7 @@ arch_get_scno(struct tcb *tcp)
        /* Retrieve the syscall trap instruction. */
        unsigned long trap;
        errno = 0;
-       trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)sparc_regs.tpc, 0);
+       trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *) sparc_regs.tpc, 0);
        if (errno)
                return -1;
        trap >>= 32;
index 9e2fc08c0bb3d725d55faf2b87683b93144a8d58..ab4867f61a6daac2ac38da771e246a6808f288c2 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1995,7 +1995,7 @@ maybe_allocate_tcb(const int pid, int status)
                /* This can happen if a clone call used
                 * CLONE_PTRACE itself.
                 */
-               ptrace(PTRACE_CONT, pid, (char *) 0, 0);
+               ptrace(PTRACE_CONT, pid, NULL, 0);
                error_msg("Stop of unknown pid %u seen, PTRACE_CONTed it", pid);
                return NULL;
        }
index ca7e83dd528661739fa2aa8d9e84b553203bbed1..2bf1554b73c85677252a97fbbd48758440a68443 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1253,7 +1253,8 @@ get_regs(pid_t pid)
 #elif defined ARCH_REGS_FOR_GETREGS
 # if defined SPARC || defined SPARC64
        /* SPARC systems have the meaning of data and addr reversed */
-       get_regs_error = ptrace(PTRACE_GETREGS, pid, (char *)&ARCH_REGS_FOR_GETREGS, 0);
+       get_regs_error =
+               ptrace(PTRACE_GETREGS, pid, (void *) &ARCH_REGS_FOR_GETREGS, 0);
 # elif defined POWERPC
        static bool old_kernel = 0;
        if (old_kernel)
diff --git a/upeek.c b/upeek.c
index f4f20bb9631ec8fb459b5b8996fad6c655293320..1edfcaa9db860d94a080cbf5780506074a3a6bb2 100644 (file)
--- a/upeek.c
+++ b/upeek.c
@@ -40,7 +40,7 @@ upeek(int pid, long off, long *res)
        long val;
 
        errno = 0;
-       val = ptrace(PTRACE_PEEKUSER, (pid_t)pid, (char *) off, 0);
+       val = ptrace(PTRACE_PEEKUSER, (pid_t) pid, (void *) off, 0);
        if (val == -1 && errno) {
                if (errno != ESRCH) {
                        perror_msg("upeek: PTRACE_PEEKUSER pid:%d @0x%lx)", pid, off);
diff --git a/util.c b/util.c
index e926f93f1f4252403483d6243dcb0d780202e4f5..3979cab9747c2a181ecff7475fe9ab23719e78d5 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1073,7 +1073,7 @@ umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr)
                n = addr & (sizeof(long) - 1);  /* residue */
                addr &= -sizeof(long);          /* aligned address */
                errno = 0;
-               u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0);
+               u.val = ptrace(PTRACE_PEEKDATA, pid, (void *) addr, 0);
                switch (errno) {
                        case 0:
                                break;
@@ -1098,7 +1098,7 @@ umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr)
        }
        while (len) {
                errno = 0;
-               u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0);
+               u.val = ptrace(PTRACE_PEEKDATA, pid, (void *) addr, 0);
                switch (errno) {
                        case 0:
                                break;
@@ -1241,7 +1241,7 @@ umovestr(struct tcb *tcp, long addr, unsigned int len, char *laddr)
                n = addr & (sizeof(long) - 1);  /* residue */
                addr &= -sizeof(long);          /* aligned address */
                errno = 0;
-               u.val = ptrace(PTRACE_PEEKDATA, pid, (char *)addr, 0);
+               u.val = ptrace(PTRACE_PEEKDATA, pid, (void *) addr, 0);
                switch (errno) {
                        case 0:
                                break;
@@ -1270,7 +1270,7 @@ umovestr(struct tcb *tcp, long addr, unsigned int len, char *laddr)
 
        while (len) {
                errno = 0;
-               u.val = ptrace(PTRACE_PEEKDATA, pid, (char *)addr, 0);
+               u.val = ptrace(PTRACE_PEEKDATA, pid, (void *) addr, 0);
                switch (errno) {
                        case 0:
                                break;