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
This commit is contained in:
Kyle Evans 2023-02-20 16:11:44 -06:00
parent d481dcee72
commit 7b5cb32fca

View File

@ -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
}