From 7b5cb32fca26428b8c0df98f9c58444557f808ae Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 20 Feb 2023 16:11:44 -0600 Subject: [PATCH] kern: physmem: properly cast %jx arguments to uintmax_t While we're here, slap prfunc with a __printflike to get compiler checking on args to catch silly mistakes like this. Reported by: jrtc27 --- sys/kern/subr_physmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_physmem.c b/sys/kern/subr_physmem.c index d371e1e166c5..a53d2cb879eb 100644 --- a/sys/kern/subr_physmem.c +++ b/sys/kern/subr_physmem.c @@ -120,7 +120,7 @@ panic(const char *fmt, ...) * db_printf). */ static void -physmem_dump_tables(int (*prfunc)(const char *, ...)) +physmem_dump_tables(int (*prfunc)(const char *, ...) __printflike(1, 2)) { size_t i; int flags; @@ -149,10 +149,12 @@ physmem_dump_tables(int (*prfunc)(const char *, ...)) #ifdef DEBUG prfunc("Avail lists:\n"); for (i = 0; phys_avail[i] != 0; ++i) { - prfunc(" phys_avail[%d] 0x%08jx\n", i, phys_avail[i]); + prfunc(" phys_avail[%d] 0x%08jx\n", i, + (uintmax_t)phys_avail[i]); } for (i = 0; dump_avail[i] != 0; ++i) { - prfunc(" dump_avail[%d] 0x%08jx\n", i, dump_avail[i]); + prfunc(" dump_avail[%d] 0x%08jx\n", i, + (uintmax_t)dump_avail[i]); } #endif }