From cdf05fb3920201898000ebcc8516ba7ca46a17f7 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Wed, 21 Dec 2016 15:36:50 +0000
Subject: [PATCH] dump*: change address argument type from long to
 kernel_ureg_t

* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
Change address argument type from long to kernel_ureg_t.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
Likewise.
* util.c (dumpiov_upto, dumpstr): Likewise.
---
 defs.h    | 16 ++++++++++++----
 mmsghdr.c |  2 +-
 msghdr.c  | 10 ++++++----
 util.c    |  5 +++--
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/defs.h b/defs.h
index 989a45d9..6f7dbbd9 100644
--- a/defs.h
+++ b/defs.h
@@ -599,10 +599,18 @@ extern const char *sprinttime(time_t);
 extern void print_symbolic_mode_t(unsigned int);
 extern void print_numeric_umode_t(unsigned short);
 extern void print_numeric_long_umask(unsigned long);
-extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long);
-extern void dumpiov_in_mmsghdr(struct tcb *, long);
-extern void dumpiov_upto(struct tcb *, int, long, unsigned long);
-extern void dumpstr(struct tcb *, long, int);
+
+extern void
+dumpiov_in_msghdr(struct tcb *, kernel_ureg_t addr, unsigned long data_size);
+
+extern void
+dumpiov_in_mmsghdr(struct tcb *, kernel_ureg_t addr);
+
+extern void
+dumpiov_upto(struct tcb *, int len, kernel_ureg_t addr, unsigned long data_size);
+
+extern void
+dumpstr(struct tcb *, kernel_ureg_t addr, int len);
 
 extern void
 printstr_ex(struct tcb *, kernel_ureg_t addr, long len,
diff --git a/mmsghdr.c b/mmsghdr.c
index 6b02774a..788a0fa9 100644
--- a/mmsghdr.c
+++ b/mmsghdr.c
@@ -149,7 +149,7 @@ decode_mmsgvec(struct tcb *const tcp, const kernel_ureg_t addr,
 }
 
 void
-dumpiov_in_mmsghdr(struct tcb *tcp, long addr)
+dumpiov_in_mmsghdr(struct tcb *const tcp, kernel_ureg_t addr)
 {
 	unsigned int len = tcp->u_rval;
 	unsigned int i, fetched;
diff --git a/msghdr.c b/msghdr.c
index 75efcd58..0c87165c 100644
--- a/msghdr.c
+++ b/msghdr.c
@@ -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,7 +391,8 @@ 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;
 
diff --git a/util.c b/util.c
index 245ffca3..bfc4134e 100644
--- a/util.c
+++ b/util.c
@@ -922,7 +922,8 @@ printstr_ex(struct tcb *const tcp, const kernel_ureg_t addr, const long len,
 }
 
 void
-dumpiov_upto(struct tcb *tcp, int len, long addr, unsigned long data_size)
+dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ureg_t addr,
+	     unsigned long data_size)
 {
 #if SUPPORTED_PERSONALITIES > 1
 	union {
@@ -974,7 +975,7 @@ dumpiov_upto(struct tcb *tcp, int len, long addr, unsigned long data_size)
 }
 
 void
-dumpstr(struct tcb *tcp, long addr, int len)
+dumpstr(struct tcb *const tcp, const kernel_ureg_t addr, const int len)
 {
 	static int strsize = -1;
 	static unsigned char *str;
-- 
2.40.0