Skip to content

Commit 670cd68

Browse files
mhiramatshuahkh
authored andcommitted
selftests: net: Fix printf format warnings on arm
Fix printf format warnings on arm (and other 32bit arch). - udpgso.c and udpgso_bench_tx use %lu for size_t but it should be unsigned long long on 32bit arch. - so_txtime.c uses %ld for int64_t, but it should be unsigned long long on 32bit arch. Signed-off-by: Masami Hiramatsu <[email protected]> Cc: Willem de Bruijn <[email protected]> Cc: David S. Miller <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent e698a23 commit 670cd68

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

tools/testing/selftests/net/so_txtime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ static void do_recv_one(int fdr, struct timed_send *ts)
105105
tstop = (gettime_ns() - glob_tstart) / 1000;
106106
texpect = ts->delay_us >= 0 ? ts->delay_us : 0;
107107

108-
fprintf(stderr, "payload:%c delay:%ld expected:%ld (us)\n",
109-
rbuf[0], tstop, texpect);
108+
fprintf(stderr, "payload:%c delay:%lld expected:%lld (us)\n",
109+
rbuf[0], (long long)tstop, (long long)texpect);
110110

111111
if (rbuf[0] != ts->data)
112112
error(1, 0, "payload mismatch. expected %c", ts->data);

tools/testing/selftests/net/udpgso.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,8 @@ static bool __send_one(int fd, struct msghdr *msg, int flags)
448448
if (ret == -1)
449449
error(1, errno, "sendmsg");
450450
if (ret != msg->msg_iov->iov_len)
451-
error(1, 0, "sendto: %d != %lu", ret, msg->msg_iov->iov_len);
451+
error(1, 0, "sendto: %d != %llu", ret,
452+
(unsigned long long)msg->msg_iov->iov_len);
452453
if (msg->msg_flags)
453454
error(1, 0, "sendmsg: return flags 0x%x\n", msg->msg_flags);
454455

tools/testing/selftests/net/udpgso_bench_tx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ static int send_udp_segment(int fd, char *data)
405405
if (ret == -1)
406406
error(1, errno, "sendmsg");
407407
if (ret != iov.iov_len)
408-
error(1, 0, "sendmsg: %u != %lu\n", ret, iov.iov_len);
408+
error(1, 0, "sendmsg: %u != %llu\n", ret,
409+
(unsigned long long)iov.iov_len);
409410

410411
return 1;
411412
}

0 commit comments

Comments
 (0)