Change last parameter of umoven() from char* to void*
Saves tons of casts. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
parent
9dce83b8bd
commit
7e69ed98cd
@ -103,7 +103,7 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
|
||||
else
|
||||
len = 1;
|
||||
|
||||
if (umoven(tcp, addr, len * sizeof(data[0]), (char *) data) < 0) {
|
||||
if (umoven(tcp, addr, len * sizeof(data[0]), data) < 0) {
|
||||
tprintf("%#lx", addr);
|
||||
return;
|
||||
}
|
||||
|
4
defs.h
4
defs.h
@ -419,9 +419,9 @@ extern void clear_regs(void);
|
||||
extern void get_regs(pid_t pid);
|
||||
extern int get_scno(struct tcb *tcp);
|
||||
|
||||
extern int umoven(struct tcb *, long, unsigned int, char *);
|
||||
extern int umoven(struct tcb *, long, unsigned int, void *);
|
||||
#define umove(pid, addr, objp) \
|
||||
umoven((pid), (addr), sizeof(*(objp)), (char *) (objp))
|
||||
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
|
||||
extern int umovestr(struct tcb *, long, unsigned int, char *);
|
||||
extern int upeek(int pid, long, long *);
|
||||
#if defined(SPARC) || defined(SPARC64) || defined(IA64) || defined(SH)
|
||||
|
6
desc.c
6
desc.c
@ -353,7 +353,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
|
||||
tprintf(", %#lx", arg);
|
||||
continue;
|
||||
}
|
||||
if (umoven(tcp, arg, fdsize, (char *) fds) < 0) {
|
||||
if (umoven(tcp, arg, fdsize, fds) < 0) {
|
||||
tprints(", [?]");
|
||||
continue;
|
||||
}
|
||||
@ -397,7 +397,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
|
||||
int first = 1;
|
||||
|
||||
arg = args[i+1];
|
||||
if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
|
||||
if (!arg || umoven(tcp, arg, fdsize, fds) < 0)
|
||||
continue;
|
||||
for (j = 0;; j++) {
|
||||
j = next_set_bit(fds, j, nfds);
|
||||
@ -445,7 +445,7 @@ sys_oldselect(struct tcb *tcp)
|
||||
{
|
||||
long args[5];
|
||||
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof args, (char *) args) < 0) {
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof args, args) < 0) {
|
||||
tprints("[...]");
|
||||
return 0;
|
||||
}
|
||||
|
2
io.c
2
io.c
@ -112,7 +112,7 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
|
||||
tprints("...");
|
||||
break;
|
||||
}
|
||||
if (umoven(tcp, cur, sizeof_iov, (char *) &iov) < 0) {
|
||||
if (umoven(tcp, cur, sizeof_iov, &iov) < 0) {
|
||||
tprints("?");
|
||||
failed = 1;
|
||||
break;
|
||||
|
3
kexec.c
3
kexec.c
@ -58,8 +58,7 @@ print_kexec_segments(struct tcb *tcp, unsigned long addr, unsigned long len)
|
||||
for (i = 0; i < len; ++i) {
|
||||
if (i)
|
||||
tprints(", ");
|
||||
if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg,
|
||||
(char *) &seg) < 0) {
|
||||
if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg, &seg) < 0) {
|
||||
tprints("?");
|
||||
failed = 1;
|
||||
break;
|
||||
|
10
mem.c
10
mem.c
@ -106,7 +106,7 @@ sys_old_mmap(struct tcb *tcp)
|
||||
*/
|
||||
int i;
|
||||
unsigned narrow_arg[6];
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
|
||||
return 0;
|
||||
for (i = 0; i < 6; i++)
|
||||
u_arg[i] = (unsigned long) narrow_arg[i];
|
||||
@ -114,12 +114,12 @@ sys_old_mmap(struct tcb *tcp)
|
||||
/* We are here only in personality 1 (i386) */
|
||||
int i;
|
||||
unsigned narrow_arg[6];
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
|
||||
return 0;
|
||||
for (i = 0; i < 6; ++i)
|
||||
u_arg[i] = (unsigned long) narrow_arg[i];
|
||||
#else
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), (char *) u_arg) == -1)
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), u_arg) == -1)
|
||||
return 0;
|
||||
#endif
|
||||
return print_mmap(tcp, u_arg, (unsigned long) u_arg[5]);
|
||||
@ -134,7 +134,7 @@ sys_old_mmap_pgoff(struct tcb *tcp)
|
||||
int i;
|
||||
unsigned narrow_arg[6];
|
||||
unsigned long long offset;
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
|
||||
return 0;
|
||||
for (i = 0; i < 5; i++)
|
||||
u_arg[i] = (unsigned long) narrow_arg[i];
|
||||
@ -362,7 +362,7 @@ get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err)
|
||||
tprints("...");
|
||||
break;
|
||||
}
|
||||
if (umoven(tcp, cur, sizeof(n), (char *) &n) < 0) {
|
||||
if (umoven(tcp, cur, sizeof(n), &n) < 0) {
|
||||
tprints("?");
|
||||
failed = 1;
|
||||
break;
|
||||
|
4
net.c
4
net.c
@ -1071,7 +1071,7 @@ do_pipe(struct tcb *tcp, int flags_arg)
|
||||
#if !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64)
|
||||
int fds[2];
|
||||
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof fds, fds) < 0)
|
||||
tprints("[...]");
|
||||
else
|
||||
tprintf("[%u, %u]", fds[0], fds[1]);
|
||||
@ -1116,7 +1116,7 @@ sys_socketpair(struct tcb *tcp)
|
||||
tprintf(", %#lx", tcp->u_arg[3]);
|
||||
return 0;
|
||||
}
|
||||
if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0)
|
||||
if (umoven(tcp, tcp->u_arg[3], sizeof fds, fds) < 0)
|
||||
tprints(", [...]");
|
||||
else
|
||||
tprintf(", [%u, %u]", fds[0], fds[1]);
|
||||
|
@ -270,7 +270,7 @@ pathtrace_match(struct tcb *tcp)
|
||||
args = tcp->u_arg;
|
||||
if (s->sys_func == sys_oldselect) {
|
||||
if (umoven(tcp, tcp->u_arg[0], sizeof oldargs,
|
||||
(char*) oldargs) < 0)
|
||||
oldargs) < 0)
|
||||
{
|
||||
fprintf(stderr, "umoven() failed\n");
|
||||
return 0;
|
||||
@ -294,7 +294,7 @@ pathtrace_match(struct tcb *tcp)
|
||||
for (i = 1; i <= 3; ++i) {
|
||||
if (args[i] == 0)
|
||||
continue;
|
||||
if (umoven(tcp, args[i], fdsize, (char *) fds) < 0) {
|
||||
if (umoven(tcp, args[i], fdsize, fds) < 0) {
|
||||
fprintf(stderr, "umoven() failed\n");
|
||||
continue;
|
||||
}
|
||||
@ -328,7 +328,7 @@ pathtrace_match(struct tcb *tcp)
|
||||
return 0;
|
||||
|
||||
for (cur = start; cur < end; cur += sizeof(fds))
|
||||
if ((umoven(tcp, cur, sizeof fds, (char *) &fds) == 0)
|
||||
if ((umoven(tcp, cur, sizeof fds, &fds) == 0)
|
||||
&& fdmatch(tcp, fds.fd))
|
||||
return 1;
|
||||
|
||||
|
2
scsi.c
2
scsi.c
@ -53,7 +53,7 @@ print_sg_io_buffer(struct tcb *tcp, unsigned long addr, const unsigned int len)
|
||||
goto out;
|
||||
allocated = (len > max_strlen) ? max_strlen : len;
|
||||
if ((buf = malloc(allocated)) == NULL ||
|
||||
umoven(tcp, addr, allocated, (char *) buf) < 0) {
|
||||
umoven(tcp, addr, allocated, buf) < 0) {
|
||||
tprintf("%#lx", addr);
|
||||
goto out;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ sys_sigreturn(struct tcb *tcp)
|
||||
/* Fetch remaining words of signal mask, located
|
||||
immediately before. */
|
||||
addr -= sizeof(mask) - sizeof(long);
|
||||
if (umoven(tcp, addr, sizeof(mask) - sizeof(long), (char *) &mask[1]) < 0)
|
||||
if (umoven(tcp, addr, sizeof(mask) - sizeof(long), &mask[1]) < 0)
|
||||
return 0;
|
||||
tprints("{mask=");
|
||||
tprintsigmask_addr("", mask);
|
||||
|
2
sock.c
2
sock.c
@ -256,7 +256,7 @@ sock_ioctl(struct tcb *tcp, const unsigned int code, long arg)
|
||||
struct ifreq ifra[nifra];
|
||||
|
||||
if (umoven(tcp, (unsigned long) ifc.ifc_buf,
|
||||
sizeof(ifra), (char *) ifra) < 0) {
|
||||
sizeof(ifra), ifra) < 0) {
|
||||
tprintf("%lx}", (unsigned long) ifc.ifc_buf);
|
||||
return 1;
|
||||
}
|
||||
|
4
stream.c
4
stream.c
@ -263,7 +263,7 @@ decode_poll(struct tcb *tcp, long pts)
|
||||
tprints("...");
|
||||
break;
|
||||
}
|
||||
if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
|
||||
if (umoven(tcp, cur, sizeof fds, &fds) < 0) {
|
||||
tprints("?");
|
||||
failed = 1;
|
||||
break;
|
||||
@ -313,7 +313,7 @@ decode_poll(struct tcb *tcp, long pts)
|
||||
outptr = outstr;
|
||||
|
||||
for (cur = start; cur < end; cur += sizeof(fds)) {
|
||||
if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
|
||||
if (umoven(tcp, cur, sizeof fds, &fds) < 0) {
|
||||
if (outptr < end_outstr - 2)
|
||||
*outptr++ = '?';
|
||||
failed = 1;
|
||||
|
@ -1559,7 +1559,7 @@ get_syscall_args(struct tcb *tcp)
|
||||
|
||||
for (i = 0; i < nargs; ++i) {
|
||||
if (umoven(tcp, (unsigned long) ia64_rse_skip_regs(out0, i),
|
||||
sizeof(long), (char *) &tcp->u_arg[i]) < 0)
|
||||
sizeof(long), &tcp->u_arg[i]) < 0)
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -1601,7 +1601,7 @@ get_syscall_args(struct tcb *tcp)
|
||||
if (nargs > 4) {
|
||||
umoven(tcp, mips_REG_SP + 4 * 4,
|
||||
(nargs - 4) * sizeof(tcp->u_arg[0]),
|
||||
(char *)(tcp->u_arg + 4));
|
||||
&tcp->u_arg[4]);
|
||||
}
|
||||
#elif defined(POWERPC)
|
||||
(void)i;
|
||||
|
2
sysctl.c
2
sysctl.c
@ -27,7 +27,7 @@ sys_sysctl(struct tcb *tcp)
|
||||
size = sizeof(int) * (unsigned long) info.nlen;
|
||||
name = (size / sizeof(int) != (unsigned long) info.nlen) ? NULL : malloc(size);
|
||||
if (name == NULL ||
|
||||
umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
|
||||
umoven(tcp, (unsigned long) info.name, size, name) < 0) {
|
||||
free(name);
|
||||
if (entering(tcp))
|
||||
tprintf("{%p, %d, %p, %p, %p, %lu}",
|
||||
|
4
uid.c
4
uid.c
@ -183,7 +183,7 @@ sys_setgroups(struct tcb *tcp)
|
||||
tprints("...");
|
||||
break;
|
||||
}
|
||||
if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
|
||||
if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
|
||||
tprints("?");
|
||||
failed = 1;
|
||||
break;
|
||||
@ -242,7 +242,7 @@ sys_getgroups(struct tcb *tcp)
|
||||
tprints("...");
|
||||
break;
|
||||
}
|
||||
if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
|
||||
if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
|
||||
tprints("?");
|
||||
failed = 1;
|
||||
break;
|
||||
|
9
util.c
9
util.c
@ -835,7 +835,7 @@ dumpiov(struct tcb *tcp, int len, long addr)
|
||||
fprintf(stderr, "Out of memory\n");
|
||||
return;
|
||||
}
|
||||
if (umoven(tcp, addr, size, (char *) iov) >= 0) {
|
||||
if (umoven(tcp, addr, size, iov) >= 0) {
|
||||
for (i = 0; i < len; i++) {
|
||||
/* include the buffer number to make it easy to
|
||||
* match up the trace with the source */
|
||||
@ -881,7 +881,7 @@ dumpstr(struct tcb *tcp, long addr, int len)
|
||||
strsize = len + 16;
|
||||
}
|
||||
|
||||
if (umoven(tcp, addr, len, (char *) str) < 0)
|
||||
if (umoven(tcp, addr, len, str) < 0)
|
||||
return;
|
||||
|
||||
/* Space-pad to 16 bytes */
|
||||
@ -966,11 +966,12 @@ static bool process_vm_readv_not_supported = 1;
|
||||
#define PAGMASK (~(PAGSIZ - 1))
|
||||
/*
|
||||
* move `len' bytes of data from process `pid'
|
||||
* at address `addr' to our space at `laddr'
|
||||
* at address `addr' to our space at `our_addr'
|
||||
*/
|
||||
int
|
||||
umoven(struct tcb *tcp, long addr, unsigned int len, char *laddr)
|
||||
umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr)
|
||||
{
|
||||
char *laddr = our_addr;
|
||||
int pid = tcp->pid;
|
||||
unsigned int n, m, nread;
|
||||
union {
|
||||
|
2
utime.c
2
utime.c
@ -19,7 +19,7 @@ sys_utime(struct tcb *tcp)
|
||||
tprints("NULL");
|
||||
else if (!verbose(tcp))
|
||||
tprintf("%#lx", tcp->u_arg[1]);
|
||||
else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
|
||||
else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, &u) < 0)
|
||||
tprints("[?, ?]");
|
||||
else if (wordsize == sizeof u.utl[0]) {
|
||||
tprintf("[%s,", sprinttime(u.utl[0]));
|
||||
|
Loading…
Reference in New Issue
Block a user