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

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 03 Oct 2022 23:11:13 UTC
The branch main has been updated by jhb:

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

commit a9fca3b987bcfa16d457b15cba2de46000f6bb86
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-10-03 23:10:41 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-10-03 23:10:41 +0000

    Fix various places which cast a pointer to a vm_paddr_t or vice versa.
    
    GCC warns about the mismatched sizes on i386 where vm_paddr_t is 64
    bits.
    
    Reviewed by:    imp, markj
    Differential Revision:  https://reviews.freebsd.org/D36750
---
 sys/dev/dcons/dcons_os.c | 2 +-
 sys/dev/fb/fbd.c         | 4 ++--
 sys/vm/vm_dumpset.h      | 2 +-
 sys/x86/xen/hvm.c        | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c
index 1a5585598065..bc1fc007fcc9 100644
--- a/sys/dev/dcons/dcons_os.c
+++ b/sys/dev/dcons/dcons_os.c
@@ -331,7 +331,7 @@ dcons_drv_init(int stage)
 #ifdef __amd64__
 		dg.buf = (struct dcons_buf *)(vm_offset_t)(KERNBASE + addr);
 #else /* __i386__ */
-		dg.buf = (struct dcons_buf *)((vm_offset_t)PMAP_MAP_LOW +
+		dg.buf = (struct dcons_buf *)(vm_offset_t)(PMAP_MAP_LOW +
 		    addr);
 #endif
 		dg.size = size;
diff --git a/sys/dev/fb/fbd.c b/sys/dev/fb/fbd.c
index 8dfc24707cd8..b640efa236b4 100644
--- a/sys/dev/fb/fbd.c
+++ b/sys/dev/fb/fbd.c
@@ -210,8 +210,8 @@ fbd_list(void)
 		return (ENOENT);
 
 	LIST_FOREACH(entry, &fb_list_head, fb_list) {
-		printf("FB %s @%p\n", entry->fb_info->fb_name,
-		    (void *)entry->fb_info->fb_pbase);
+		printf("FB %s @%#jx\n", entry->fb_info->fb_name,
+		    (uintmax_t)entry->fb_info->fb_pbase);
 	}
 
 	return (0);
diff --git a/sys/vm/vm_dumpset.h b/sys/vm/vm_dumpset.h
index f9ba6b2429c5..aef056246d96 100644
--- a/sys/vm/vm_dumpset.h
+++ b/sys/vm/vm_dumpset.h
@@ -92,7 +92,7 @@ vm_page_dump_index_to_pa(int bit)
 			    (dump_avail[i] & ~PAGE_MASK));
 		bit -= tot;
 	}
-	return ((vm_paddr_t)NULL);
+	return (0);
 }
 
 #define VM_PAGE_DUMP_FOREACH(bitset, pa)				\
diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
index 8d25e35e5151..8edbda445dd5 100644
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -197,7 +197,7 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
 		return (EINVAL);
 
 	wrmsr(regs[1], (init_type == XEN_HVM_INIT_EARLY)
-	    ? ((vm_paddr_t)&hypercall_page - KERNBASE)
+	    ? (vm_paddr_t)((uintptr_t)&hypercall_page - KERNBASE)
 	    : vtophys(&hypercall_page));
 
 	return (0);