git: c5eed4146fc9 - main - Fix various places which cast a pointer to a uint64_t or vice versa.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 28 Sep 2022 21:06:39 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=c5eed4146fc9ac6abeef9e26f6675e86d0888443

commit c5eed4146fc9ac6abeef9e26f6675e86d0888443
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-09-28 20:58:02 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-09-28 20:58:02 +0000

    Fix various places which cast a pointer to a uint64_t or vice versa.
    
    GCC warns about the mismatched sizes on 32-bit platforms.
    
    Reviewed by:    imp, markj
    Differential Revision:  https://reviews.freebsd.org/D36752
---
 sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c | 2 +-
 sys/dev/iser/iser_initiator.c                         | 2 +-
 sys/dev/mana/gdma_main.c                              | 8 ++++----
 sys/dev/mana/hw_channel.c                             | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c
index 020ef6a39b5e..0a19fbba717d 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c
@@ -131,7 +131,7 @@ zfsdev_ioctl(struct cdev *dev, ulong_t zcmd, caddr_t arg, int flag,
 	len = IOCPARM_LEN(zcmd);
 	vecnum = zcmd & 0xff;
 	zp = (void *)arg;
-	uaddr = (void *)zp->zfs_cmd;
+	uaddr = (void *)(uintptr_t)zp->zfs_cmd;
 	error = 0;
 	zcl = NULL;
 
diff --git a/sys/dev/iser/iser_initiator.c b/sys/dev/iser/iser_initiator.c
index 49960c29a614..4e426240c882 100644
--- a/sys/dev/iser/iser_initiator.c
+++ b/sys/dev/iser/iser_initiator.c
@@ -290,7 +290,7 @@ iser_buf_to_sg(void *buf, struct iser_data_buf *data_buf)
 		offset = ((uintptr_t)buf) & ~PAGE_MASK;
 		len = min(PAGE_SIZE - offset, tlen);
 		sg_set_buf(sg, buf, len);
-		buf = (void *)(((u64)buf) + (u64)len);
+		buf = (void *)((uintptr_t)buf + len);
 	}
 
 	data_buf->size = i;
diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c
index 60ddde142f44..6bda6eae13eb 100644
--- a/sys/dev/mana/gdma_main.c
+++ b/sys/dev/mana/gdma_main.c
@@ -949,7 +949,7 @@ mana_gd_create_dma_region(struct gdma_dev *gd,
 		return EINVAL;
 	}
 
-	if (offset_in_page((uint64_t)gmi->virt_addr) != 0) {
+	if (offset_in_page((uintptr_t)gmi->virt_addr) != 0) {
 		mana_err(NULL, "gmi not page aligned: %p\n",
 		    gmi->virt_addr);
 		return EINVAL;
@@ -1508,19 +1508,19 @@ mana_gd_free_res_map(struct gdma_resource *r)
 static void
 mana_gd_init_registers(struct gdma_context *gc)
 {
-	uint64_t bar0_va = rman_get_bushandle(gc->bar0);
+	uintptr_t bar0_va = rman_get_bushandle(gc->bar0);
 	vm_paddr_t bar0_pa = rman_get_start(gc->bar0);
 
 	gc->db_page_size = mana_gd_r32(gc, GDMA_REG_DB_PAGE_SIZE) & 0xFFFF;
 
 	gc->db_page_base =
-	    (void *) (bar0_va + mana_gd_r64(gc, GDMA_REG_DB_PAGE_OFFSET));
+	    (void *)(bar0_va + (size_t)mana_gd_r64(gc, GDMA_REG_DB_PAGE_OFFSET));
 
 	gc->phys_db_page_base =
 	    bar0_pa + mana_gd_r64(gc, GDMA_REG_DB_PAGE_OFFSET);
 
 	gc->shm_base =
-	    (void *) (bar0_va + mana_gd_r64(gc, GDMA_REG_SHM_OFFSET));
+	    (void *)(bar0_va + (size_t)mana_gd_r64(gc, GDMA_REG_SHM_OFFSET));
 
 	mana_dbg(NULL, "db_page_size 0x%xx, db_page_base %p,"
 		    " shm_base %p\n",
diff --git a/sys/dev/mana/hw_channel.c b/sys/dev/mana/hw_channel.c
index 19e25a8a49ab..845a47eac96a 100644
--- a/sys/dev/mana/hw_channel.c
+++ b/sys/dev/mana/hw_channel.c
@@ -128,7 +128,7 @@ mana_hwc_post_rx_wqe(const struct hwc_wq *hwc_rxq,
 	int err;
 
 	sge = &req->sge;
-	sge->address = (uint64_t)req->buf_sge_addr;
+	sge->address = (uintptr_t)req->buf_sge_addr;
 	sge->mem_key = hwc_rxq->msg_buf->gpa_mkey;
 	sge->size = req->buf_len;
 
@@ -616,7 +616,7 @@ mana_hwc_post_tx_wqe(const struct hwc_wq *hwc_txq,
 	tx_oob->vsq_id = hwc_txq->gdma_wq->id;
 
 	sge = &req->sge;
-	sge->address = (uint64_t)req->buf_sge_addr;
+	sge->address = (uintptr_t)req->buf_sge_addr;
 	sge->mem_key = hwc_txq->msg_buf->gpa_mkey;
 	sge->size = req->msg_size;