]> granicus.if.org Git - strace/blobdiff - msghdr.c
io: change size types from unsigned long to kernel_ureg_t
[strace] / msghdr.c
index 8c6b680c223fd26c16fa460366c560bf1e3872c2..0c87165c09e510b0b090829d03130d1cd4683213 100644 (file)
--- a/msghdr.c
+++ b/msghdr.c
@@ -249,7 +249,7 @@ get_optmem_max(void)
 }
 
 static void
-decode_msg_control(struct tcb *tcp, unsigned long addr,
+decode_msg_control(struct tcb *const tcp, const kernel_ureg_t addr,
                   const size_t in_control_len)
 {
        if (!in_control_len)
@@ -340,7 +340,7 @@ print_struct_msghdr(struct tcb *tcp, const struct msghdr *msg,
 
        tprints("{msg_name=");
        const int family =
-               decode_sockaddr(tcp, (long) msg->msg_name, msg_namelen);
+               decode_sockaddr(tcp, (kernel_ureg_t) msg->msg_name, msg_namelen);
        const enum iov_decode decode =
                (family == AF_NETLINK) ? IOV_DECODE_NETLINK : IOV_DECODE_STR;
 
@@ -365,7 +365,8 @@ print_struct_msghdr(struct tcb *tcp, const struct msghdr *msg,
 }
 
 static bool
-fetch_msghdr_namelen(struct tcb *tcp, const long addr, int *const p_msg_namelen)
+fetch_msghdr_namelen(struct tcb *const tcp, const kernel_ureg_t addr,
+                    int *const p_msg_namelen)
 {
        struct msghdr msg;
 
@@ -378,8 +379,8 @@ fetch_msghdr_namelen(struct tcb *tcp, const long addr, int *const p_msg_namelen)
 }
 
 static void
-decode_msghdr(struct tcb *tcp, const int *const p_user_msg_namelen,
-             const long addr, const unsigned long data_size)
+decode_msghdr(struct tcb *const tcp, const int *const p_user_msg_namelen,
+             const kernel_ureg_t addr, const unsigned long data_size)
 {
        struct msghdr msg;
 
@@ -390,12 +391,15 @@ decode_msghdr(struct tcb *tcp, const int *const p_user_msg_namelen,
 }
 
 void
-dumpiov_in_msghdr(struct tcb *tcp, long addr, unsigned long data_size)
+dumpiov_in_msghdr(struct tcb *const tcp, const kernel_ureg_t addr,
+                 const unsigned long data_size)
 {
        struct msghdr msg;
 
-       if (fetch_struct_msghdr(tcp, addr, &msg))
-               dumpiov_upto(tcp, msg.msg_iovlen, (long)msg.msg_iov, data_size);
+       if (fetch_struct_msghdr(tcp, addr, &msg)) {
+               dumpiov_upto(tcp, msg.msg_iovlen,
+                            (kernel_ureg_t) msg.msg_iov, data_size);
+       }
 }
 
 SYS_FUNC(sendmsg)