From: Eugene Syromyatnikov Date: Wed, 7 Sep 2016 12:41:17 +0000 (+0300) Subject: ipc: fix printing of integer arguments X-Git-Tag: v4.14~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=047c42e7c8be66aeef1242927f5198e363ba88ee;p=strace ipc: fix printing of integer arguments * ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int by the kernel, cast it to int and print it using %d format. * ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise, for semid argument. (SYS_FUNC(semget)): Likewise, for nsems argument. (SYS_FUNC(semctl)): Likewise, for semid and semnum arguments. * ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument. * ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise. --- diff --git a/ipc_msgctl.c b/ipc_msgctl.c index 9be35cef..a7352cb9 100644 --- a/ipc_msgctl.c +++ b/ipc_msgctl.c @@ -97,7 +97,7 @@ print_msqid_ds(struct tcb *tcp, const long addr, int cmd) SYS_FUNC(msgctl) { if (entering(tcp)) { - tprintf("%lu, ", tcp->u_arg[0]); + tprintf("%d, ", (int) tcp->u_arg[0]); PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???"); tprints(", "); } else { diff --git a/ipc_sem.c b/ipc_sem.c index abcfa857..4725a170 100644 --- a/ipc_sem.c +++ b/ipc_sem.c @@ -71,7 +71,7 @@ tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count) SYS_FUNC(semop) { - tprintf("%lu, ", tcp->u_arg[0]); + tprintf("%d, ", (int) tcp->u_arg[0]); if (indirect_ipccall(tcp)) { tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]); } else { @@ -82,7 +82,7 @@ SYS_FUNC(semop) SYS_FUNC(semtimedop) { - tprintf("%lu, ", tcp->u_arg[0]); + tprintf("%d, ", (int) tcp->u_arg[0]); if (indirect_ipccall(tcp)) { tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]); tprints(", "); @@ -106,7 +106,7 @@ SYS_FUNC(semget) tprintf("%#x", key); else tprints("IPC_PRIVATE"); - tprintf(", %lu, ", tcp->u_arg[1]); + tprintf(", %d, ", (int) tcp->u_arg[1]); if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0) tprints("|"); print_numeric_umode_t(tcp->u_arg[2] & 0777); @@ -115,7 +115,7 @@ SYS_FUNC(semget) SYS_FUNC(semctl) { - tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); + tprintf("%d, %d, ", (int) tcp->u_arg[0], (int) tcp->u_arg[1]); PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???"); tprints(", "); if (indirect_ipccall(tcp) diff --git a/ipc_shm.c b/ipc_shm.c index 93c8a27d..f9a05374 100644 --- a/ipc_shm.c +++ b/ipc_shm.c @@ -58,7 +58,7 @@ SYS_FUNC(shmget) SYS_FUNC(shmat) { if (entering(tcp)) { - tprintf("%lu, ", tcp->u_arg[0]); + tprintf("%d, ", (int) tcp->u_arg[0]); if (indirect_ipccall(tcp)) { printaddr(tcp->u_arg[3]); tprints(", "); diff --git a/ipc_shmctl.c b/ipc_shmctl.c index 7ea36729..12bb806b 100644 --- a/ipc_shmctl.c +++ b/ipc_shmctl.c @@ -97,7 +97,7 @@ print_shmid_ds(struct tcb *tcp, const long addr, int cmd) SYS_FUNC(shmctl) { if (entering(tcp)) { - tprintf("%lu, ", tcp->u_arg[0]); + tprintf("%d, ", (int) tcp->u_arg[0]); PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???"); tprints(", "); } else {