Browse Source

Change last parameter of umoven() from char* to void*

Saves tons of casts.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Denys Vlasenko 5 years ago
parent
commit
7e69ed98cd
17 changed files with 34 additions and 34 deletions
  1. 1
    1
      capability.c
  2. 2
    2
      defs.h
  3. 3
    3
      desc.c
  4. 1
    1
      io.c
  5. 1
    2
      kexec.c
  6. 5
    5
      mem.c
  7. 2
    2
      net.c
  8. 3
    3
      pathtrace.c
  9. 1
    1
      scsi.c
  10. 1
    1
      sigreturn.c
  11. 1
    1
      sock.c
  12. 2
    2
      stream.c
  13. 2
    2
      syscall.c
  14. 1
    1
      sysctl.c
  15. 2
    2
      uid.c
  16. 5
    4
      util.c
  17. 1
    1
      utime.c

+ 1
- 1
capability.c View File

@@ -103,7 +103,7 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
103 103
 	else
104 104
 		len = 1;
105 105
 
106
-	if (umoven(tcp, addr, len * sizeof(data[0]), (char *) data) < 0) {
106
+	if (umoven(tcp, addr, len * sizeof(data[0]), data) < 0) {
107 107
 		tprintf("%#lx", addr);
108 108
 		return;
109 109
 	}

+ 2
- 2
defs.h View File

@@ -419,9 +419,9 @@ extern void clear_regs(void);
419 419
 extern void get_regs(pid_t pid);
420 420
 extern int get_scno(struct tcb *tcp);
421 421
 
422
-extern int umoven(struct tcb *, long, unsigned int, char *);
422
+extern int umoven(struct tcb *, long, unsigned int, void *);
423 423
 #define umove(pid, addr, objp)	\
424
-	umoven((pid), (addr), sizeof(*(objp)), (char *) (objp))
424
+	umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
425 425
 extern int umovestr(struct tcb *, long, unsigned int, char *);
426 426
 extern int upeek(int pid, long, long *);
427 427
 #if defined(SPARC) || defined(SPARC64) || defined(IA64) || defined(SH)

+ 3
- 3
desc.c View File

@@ -353,7 +353,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
353 353
 				tprintf(", %#lx", arg);
354 354
 				continue;
355 355
 			}
356
-			if (umoven(tcp, arg, fdsize, (char *) fds) < 0) {
356
+			if (umoven(tcp, arg, fdsize, fds) < 0) {
357 357
 				tprints(", [?]");
358 358
 				continue;
359 359
 			}
@@ -397,7 +397,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
397 397
 			int first = 1;
398 398
 
399 399
 			arg = args[i+1];
400
-			if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
400
+			if (!arg || umoven(tcp, arg, fdsize, fds) < 0)
401 401
 				continue;
402 402
 			for (j = 0;; j++) {
403 403
 				j = next_set_bit(fds, j, nfds);
@@ -445,7 +445,7 @@ sys_oldselect(struct tcb *tcp)
445 445
 {
446 446
 	long args[5];
447 447
 
448
-	if (umoven(tcp, tcp->u_arg[0], sizeof args, (char *) args) < 0) {
448
+	if (umoven(tcp, tcp->u_arg[0], sizeof args, args) < 0) {
449 449
 		tprints("[...]");
450 450
 		return 0;
451 451
 	}

+ 1
- 1
io.c View File

@@ -112,7 +112,7 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
112 112
 			tprints("...");
113 113
 			break;
114 114
 		}
115
-		if (umoven(tcp, cur, sizeof_iov, (char *) &iov) < 0) {
115
+		if (umoven(tcp, cur, sizeof_iov, &iov) < 0) {
116 116
 			tprints("?");
117 117
 			failed = 1;
118 118
 			break;

+ 1
- 2
kexec.c View File

@@ -58,8 +58,7 @@ print_kexec_segments(struct tcb *tcp, unsigned long addr, unsigned long len)
58 58
 	for (i = 0; i < len; ++i) {
59 59
 		if (i)
60 60
 			tprints(", ");
61
-		if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg,
62
-			   (char *) &seg) < 0) {
61
+		if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg, &seg) < 0) {
63 62
 			tprints("?");
64 63
 			failed = 1;
65 64
 			break;

+ 5
- 5
mem.c View File

@@ -106,7 +106,7 @@ sys_old_mmap(struct tcb *tcp)
106 106
 	 */
107 107
 	int i;
108 108
 	unsigned narrow_arg[6];
109
-	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
109
+	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
110 110
 		return 0;
111 111
 	for (i = 0; i < 6; i++)
112 112
 		u_arg[i] = (unsigned long) narrow_arg[i];
@@ -114,12 +114,12 @@ sys_old_mmap(struct tcb *tcp)
114 114
 	/* We are here only in personality 1 (i386) */
115 115
 	int i;
116 116
 	unsigned narrow_arg[6];
117
-	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
117
+	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
118 118
 		return 0;
119 119
 	for (i = 0; i < 6; ++i)
120 120
 		u_arg[i] = (unsigned long) narrow_arg[i];
121 121
 #else
122
-	if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), (char *) u_arg) == -1)
122
+	if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), u_arg) == -1)
123 123
 		return 0;
124 124
 #endif
125 125
 	return print_mmap(tcp, u_arg, (unsigned long) u_arg[5]);
@@ -134,7 +134,7 @@ sys_old_mmap_pgoff(struct tcb *tcp)
134 134
 	int i;
135 135
 	unsigned narrow_arg[6];
136 136
 	unsigned long long offset;
137
-	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
137
+	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
138 138
 		return 0;
139 139
 	for (i = 0; i < 5; i++)
140 140
 		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)
362 362
 				tprints("...");
363 363
 				break;
364 364
 			}
365
-			if (umoven(tcp, cur, sizeof(n), (char *) &n) < 0) {
365
+			if (umoven(tcp, cur, sizeof(n), &n) < 0) {
366 366
 				tprints("?");
367 367
 				failed = 1;
368 368
 				break;

+ 2
- 2
net.c View File

@@ -1071,7 +1071,7 @@ do_pipe(struct tcb *tcp, int flags_arg)
1071 1071
 #if !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64)
1072 1072
 			int fds[2];
1073 1073
 
1074
-			if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
1074
+			if (umoven(tcp, tcp->u_arg[0], sizeof fds, fds) < 0)
1075 1075
 				tprints("[...]");
1076 1076
 			else
1077 1077
 				tprintf("[%u, %u]", fds[0], fds[1]);
@@ -1116,7 +1116,7 @@ sys_socketpair(struct tcb *tcp)
1116 1116
 			tprintf(", %#lx", tcp->u_arg[3]);
1117 1117
 			return 0;
1118 1118
 		}
1119
-		if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0)
1119
+		if (umoven(tcp, tcp->u_arg[3], sizeof fds, fds) < 0)
1120 1120
 			tprints(", [...]");
1121 1121
 		else
1122 1122
 			tprintf(", [%u, %u]", fds[0], fds[1]);

+ 3
- 3
pathtrace.c View File

@@ -270,7 +270,7 @@ pathtrace_match(struct tcb *tcp)
270 270
 		args = tcp->u_arg;
271 271
 		if (s->sys_func == sys_oldselect) {
272 272
 			if (umoven(tcp, tcp->u_arg[0], sizeof oldargs,
273
-				   (char*) oldargs) < 0)
273
+				   oldargs) < 0)
274 274
 			{
275 275
 				fprintf(stderr, "umoven() failed\n");
276 276
 				return 0;
@@ -294,7 +294,7 @@ pathtrace_match(struct tcb *tcp)
294 294
 		for (i = 1; i <= 3; ++i) {
295 295
 			if (args[i] == 0)
296 296
 				continue;
297
-			if (umoven(tcp, args[i], fdsize, (char *) fds) < 0) {
297
+			if (umoven(tcp, args[i], fdsize, fds) < 0) {
298 298
 				fprintf(stderr, "umoven() failed\n");
299 299
 				continue;
300 300
 			}
@@ -328,7 +328,7 @@ pathtrace_match(struct tcb *tcp)
328 328
 			return 0;
329 329
 
330 330
 		for (cur = start; cur < end; cur += sizeof(fds))
331
-			if ((umoven(tcp, cur, sizeof fds, (char *) &fds) == 0)
331
+			if ((umoven(tcp, cur, sizeof fds, &fds) == 0)
332 332
 			    && fdmatch(tcp, fds.fd))
333 333
 				return 1;
334 334
 

+ 1
- 1
scsi.c View File

@@ -53,7 +53,7 @@ print_sg_io_buffer(struct tcb *tcp, unsigned long addr, const unsigned int len)
53 53
 		goto out;
54 54
 	allocated = (len > max_strlen) ? max_strlen : len;
55 55
 	if ((buf = malloc(allocated)) == NULL ||
56
-	    umoven(tcp, addr, allocated, (char *) buf) < 0) {
56
+	    umoven(tcp, addr, allocated, buf) < 0) {
57 57
 		tprintf("%#lx", addr);
58 58
 		goto out;
59 59
 	}

+ 1
- 1
sigreturn.c View File

@@ -138,7 +138,7 @@ sys_sigreturn(struct tcb *tcp)
138 138
 		/* Fetch remaining words of signal mask, located
139 139
 		   immediately before.  */
140 140
 		addr -= sizeof(mask) - sizeof(long);
141
-		if (umoven(tcp, addr, sizeof(mask) - sizeof(long), (char *) &mask[1]) < 0)
141
+		if (umoven(tcp, addr, sizeof(mask) - sizeof(long), &mask[1]) < 0)
142 142
 			return 0;
143 143
 		tprints("{mask=");
144 144
 		tprintsigmask_addr("", mask);

+ 1
- 1
sock.c View File

@@ -256,7 +256,7 @@ sock_ioctl(struct tcb *tcp, const unsigned int code, long arg)
256 256
 			struct ifreq ifra[nifra];
257 257
 
258 258
 			if (umoven(tcp, (unsigned long) ifc.ifc_buf,
259
-				sizeof(ifra), (char *) ifra) < 0) {
259
+				sizeof(ifra), ifra) < 0) {
260 260
 				tprintf("%lx}", (unsigned long) ifc.ifc_buf);
261 261
 				return 1;
262 262
 			}

+ 2
- 2
stream.c View File

@@ -263,7 +263,7 @@ decode_poll(struct tcb *tcp, long pts)
263 263
 				tprints("...");
264 264
 				break;
265 265
 			}
266
-			if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
266
+			if (umoven(tcp, cur, sizeof fds, &fds) < 0) {
267 267
 				tprints("?");
268 268
 				failed = 1;
269 269
 				break;
@@ -313,7 +313,7 @@ decode_poll(struct tcb *tcp, long pts)
313 313
 		outptr = outstr;
314 314
 
315 315
 		for (cur = start; cur < end; cur += sizeof(fds)) {
316
-			if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
316
+			if (umoven(tcp, cur, sizeof fds, &fds) < 0) {
317 317
 				if (outptr < end_outstr - 2)
318 318
 					*outptr++ = '?';
319 319
 				failed = 1;

+ 2
- 2
syscall.c View File

@@ -1559,7 +1559,7 @@ get_syscall_args(struct tcb *tcp)
1559 1559
 
1560 1560
 		for (i = 0; i < nargs; ++i) {
1561 1561
 			if (umoven(tcp, (unsigned long) ia64_rse_skip_regs(out0, i),
1562
-				   sizeof(long), (char *) &tcp->u_arg[i]) < 0)
1562
+				   sizeof(long), &tcp->u_arg[i]) < 0)
1563 1563
 				return -1;
1564 1564
 		}
1565 1565
 	} else {
@@ -1601,7 +1601,7 @@ get_syscall_args(struct tcb *tcp)
1601 1601
 	if (nargs > 4) {
1602 1602
 		umoven(tcp, mips_REG_SP + 4 * 4,
1603 1603
 		       (nargs - 4) * sizeof(tcp->u_arg[0]),
1604
-		       (char *)(tcp->u_arg + 4));
1604
+		       &tcp->u_arg[4]);
1605 1605
 	}
1606 1606
 #elif defined(POWERPC)
1607 1607
 	(void)i;

+ 1
- 1
sysctl.c View File

@@ -27,7 +27,7 @@ sys_sysctl(struct tcb *tcp)
27 27
 	size = sizeof(int) * (unsigned long) info.nlen;
28 28
 	name = (size / sizeof(int) != (unsigned long) info.nlen) ? NULL : malloc(size);
29 29
 	if (name == NULL ||
30
-	    umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
30
+	    umoven(tcp, (unsigned long) info.name, size, name) < 0) {
31 31
 		free(name);
32 32
 		if (entering(tcp))
33 33
 			tprintf("{%p, %d, %p, %p, %p, %lu}",

+ 2
- 2
uid.c View File

@@ -183,7 +183,7 @@ sys_setgroups(struct tcb *tcp)
183 183
 				tprints("...");
184 184
 				break;
185 185
 			}
186
-			if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
186
+			if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
187 187
 				tprints("?");
188 188
 				failed = 1;
189 189
 				break;
@@ -242,7 +242,7 @@ sys_getgroups(struct tcb *tcp)
242 242
 				tprints("...");
243 243
 				break;
244 244
 			}
245
-			if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
245
+			if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
246 246
 				tprints("?");
247 247
 				failed = 1;
248 248
 				break;

+ 5
- 4
util.c View File

@@ -835,7 +835,7 @@ dumpiov(struct tcb *tcp, int len, long addr)
835 835
 		fprintf(stderr, "Out of memory\n");
836 836
 		return;
837 837
 	}
838
-	if (umoven(tcp, addr, size, (char *) iov) >= 0) {
838
+	if (umoven(tcp, addr, size, iov) >= 0) {
839 839
 		for (i = 0; i < len; i++) {
840 840
 			/* include the buffer number to make it easy to
841 841
 			 * match up the trace with the source */
@@ -881,7 +881,7 @@ dumpstr(struct tcb *tcp, long addr, int len)
881 881
 		strsize = len + 16;
882 882
 	}
883 883
 
884
-	if (umoven(tcp, addr, len, (char *) str) < 0)
884
+	if (umoven(tcp, addr, len, str) < 0)
885 885
 		return;
886 886
 
887 887
 	/* Space-pad to 16 bytes */
@@ -966,11 +966,12 @@ static bool process_vm_readv_not_supported = 1;
966 966
 #define PAGMASK	(~(PAGSIZ - 1))
967 967
 /*
968 968
  * move `len' bytes of data from process `pid'
969
- * at address `addr' to our space at `laddr'
969
+ * at address `addr' to our space at `our_addr'
970 970
  */
971 971
 int
972
-umoven(struct tcb *tcp, long addr, unsigned int len, char *laddr)
972
+umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr)
973 973
 {
974
+	char *laddr = our_addr;
974 975
 	int pid = tcp->pid;
975 976
 	unsigned int n, m, nread;
976 977
 	union {

+ 1
- 1
utime.c View File

@@ -19,7 +19,7 @@ sys_utime(struct tcb *tcp)
19 19
 			tprints("NULL");
20 20
 		else if (!verbose(tcp))
21 21
 			tprintf("%#lx", tcp->u_arg[1]);
22
-		else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
22
+		else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, &u) < 0)
23 23
 			tprints("[?, ?]");
24 24
 		else if (wordsize == sizeof u.utl[0]) {
25 25
 			tprintf("[%s,", sprinttime(u.utl[0]));

Loading…
Cancel
Save