dragonboards: sync up vendor userspace daemons to upstream sources

Sync up the vendor userspace daemons, used to bring
up the remoteprocs, to their upstream sources.

The following projects are being synced up to the
associated upstream commit IDs.

https://github.com/andersson/pd-mapper
9d78fc0c6143 (pd-mapper: Null terminate firmware_value string")

https://github.com/andersson/qrtr
commit 9dc7a88548c2 ("libqrtr: Zero-initialize sockaddr_qrtr")
Note: Dropped qrtr changes from commit
      47e48a8d935b ("Android: Disable "treat warnings as errors".")
      https://github.com/andersson/qrtr/commit/47e48a8d935b

https://github.com/andersson/rmtfs
695d0668ffa6 ("storage: fix out of bounds read")

https://github.com/andersson/tqftpserv
783425b550de ("ANDROID: Add Android.bp makefile")

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: Ic08ccff151c012f17e2dfe9529a91b2d1931df57
diff --git a/qcom/qrtr/lib/libqrtr.h b/qcom/qrtr/lib/libqrtr.h
index 87433ed..93254df 100644
--- a/qcom/qrtr/lib/libqrtr.h
+++ b/qcom/qrtr/lib/libqrtr.h
@@ -4,6 +4,7 @@
 #include <linux/qrtr.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <stddef.h>
 #include <stdint.h>
 
 #ifdef __cplusplus
@@ -11,7 +12,7 @@
 #endif
 
 #ifndef offsetof
-#define offsetof(type, md) ((unsigned long)&((type *)0)->md)
+#define offsetof(type, md) ((size_t)&((type *)0)->md)
 #endif
 
 #ifndef container_of
@@ -90,7 +91,7 @@
 	uint32_t elem_size;
 	enum qmi_array_type array_type;
 	uint8_t tlv_type;
-	uint32_t offset;
+	size_t offset;
 	struct qmi_elem_info *ei_array;
 };
 
diff --git a/qcom/qrtr/lib/qmi.c b/qcom/qrtr/lib/qmi.c
index f1c0293..d217a2d 100644
--- a/qcom/qrtr/lib/qmi.c
+++ b/qcom/qrtr/lib/qmi.c
@@ -249,8 +249,8 @@
 			LOGW("%s: STRUCT Encode failure\n", __func__);
 			return rc;
 		}
-		buf_dst = (char*)buf_dst + rc;
-		buf_src = (char*)buf_src + temp_ei->elem_size;
+		buf_dst = (void*)((char*)buf_dst + rc);
+		buf_src = (void*)((char*)buf_src + temp_ei->elem_size);
 		encoded_bytes += rc;
 	}
 
@@ -310,7 +310,7 @@
 		encoded_bytes += rc;
 	}
 
-	rc = qmi_encode_basic_elem((char*)buf_dst + encoded_bytes, buf_src,
+	rc = qmi_encode_basic_elem((void*)((char*)buf_dst + encoded_bytes), buf_src,
 				   string_len, temp_ei->elem_size);
 	encoded_bytes += rc;
 
@@ -354,7 +354,7 @@
 		buf_dst = buf_dst + (TLV_LEN_SIZE + TLV_TYPE_SIZE);
 
 	while (temp_ei->data_type != QMI_EOTI) {
-		buf_src = (char*)in_c_struct + temp_ei->offset;
+		buf_src = (void*)((char*)in_c_struct + temp_ei->offset);
 		tlv_type = temp_ei->tlv_type;
 
 		if (temp_ei->array_type == NO_ARRAY) {
@@ -522,8 +522,8 @@
 				tlv_len - decoded_bytes, dec_level);
 		if (rc < 0)
 			return rc;
-		buf_src = (char*)buf_src + rc;
-		buf_dst = (char*)buf_dst + temp_ei->elem_size;
+		buf_src = (void*)((char*)buf_src + rc);
+		buf_dst = (void*)((char*)buf_dst + temp_ei->elem_size);
 		decoded_bytes += rc;
 	}
 
@@ -585,7 +585,7 @@
 		return -EFAULT;
 	}
 
-	rc = qmi_decode_basic_elem(buf_dst, (char*)buf_src + decoded_bytes,
+	rc = qmi_decode_basic_elem(buf_dst, (void*)((char*)buf_src + decoded_bytes),
 				   string_len, temp_ei->elem_size);
 	*((char *)buf_dst + string_len) = '\0';
 	decoded_bytes += rc;
@@ -654,7 +654,7 @@
 			tlv_pointer = buf_src;
 			QMI_ENCDEC_DECODE_TLV(&tlv_type,
 					      &tlv_len, tlv_pointer);
-			buf_src = (uint8_t*)buf_src + (TLV_TYPE_SIZE + TLV_LEN_SIZE);
+			buf_src = (void*)((char*)buf_src + (TLV_TYPE_SIZE + TLV_LEN_SIZE));
 			decoded_bytes += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
 			temp_ei = find_ei(ei_array, tlv_type);
 			if (!temp_ei && tlv_type < OPTIONAL_TLV_TYPE_START) {
@@ -673,11 +673,11 @@
 			tlv_len = in_buf_len - decoded_bytes;
 		}
 
-		buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
+		buf_dst = (void*)((char*)out_c_struct + temp_ei->offset);
 		if (temp_ei->data_type == QMI_OPT_FLAG) {
 			memcpy(buf_dst, &opt_flag_value, sizeof(uint8_t));
 			temp_ei = temp_ei + 1;
-			buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
+			buf_dst = (void*)((char*)out_c_struct + temp_ei->offset);
 		}
 
 		if (temp_ei->data_type == QMI_DATA_LEN) {
@@ -687,7 +687,7 @@
 						   1, data_len_sz);
 			memcpy(buf_dst, &data_len_value, sizeof(uint32_t));
 			temp_ei = temp_ei + 1;
-			buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
+			buf_dst = (void*)((char*)out_c_struct + temp_ei->offset);
 			tlv_len -= data_len_sz;
 			UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
 		}
@@ -777,7 +777,7 @@
 
 	/* Encode message, if we have a message */
 	if (c_struct) {
-		msglen = qmi_encode(ei, (char*)pkt->data + sizeof(*hdr), c_struct,
+		msglen = qmi_encode(ei, (void*)((char*)pkt->data + sizeof(*hdr)), c_struct,
 				    pkt->data_len - sizeof(*hdr), 1);
 		if (msglen < 0)
 			return msglen;
@@ -839,7 +839,7 @@
 	if (txn)
 		*txn = hdr->txn_id;
 
-	return qmi_decode(ei, c_struct, (char*)pkt->data + sizeof(*hdr), pkt->data_len - sizeof(*hdr), 1);
+	return qmi_decode(ei, c_struct, (void*)((char*)pkt->data + sizeof(*hdr)), pkt->data_len - sizeof(*hdr), 1);
 }
 
 /* Common header in all QMI responses */
diff --git a/qcom/qrtr/lib/qrtr.c b/qcom/qrtr/lib/qrtr.c
index 7c1c389..96756ba 100644
--- a/qcom/qrtr/lib/qrtr.c
+++ b/qcom/qrtr/lib/qrtr.c
@@ -52,7 +52,7 @@
 	}
 
 	if (rport != 0) {
-		struct sockaddr_qrtr sq;
+		struct sockaddr_qrtr sq = {};
 
 		sq.sq_family = AF_QIPCRTR;
 		sq.sq_node = 1;
@@ -78,7 +78,7 @@
 
 int qrtr_sendto(int sock, uint32_t node, uint32_t port, const void *data, unsigned int sz)
 {
-	struct sockaddr_qrtr sq;
+	struct sockaddr_qrtr sq = {};
 	int rc;
 
 	sq.sq_family = AF_QIPCRTR;