From 0649caae326cfda8cf98ec267b27854e6de97d1a Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 14 Jul 2016 18:49:05 +0000 Subject: [PATCH] Let DDB's buf printer handle NULL pointers in the buf page array. A buf's b_pages and b_npages fields may be inconsistent after a panic. For instance, vfs_vmio_invalidate() sets b_npages to zero only after all pages are unwired and their page array entries are cleared. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- sys/kern/vfs_bio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 9ce8451daed1..2378ad653f3f 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4725,8 +4725,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) for (i = 0; i < bp->b_npages; i++) { vm_page_t m; m = bp->b_pages[i]; - db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, - (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); + if (m != NULL) + db_printf("(%p, 0x%lx, 0x%lx)", m->object, + (u_long)m->pindex, + (u_long)VM_PAGE_TO_PHYS(m)); + else + db_printf("( ??? )"); if ((i + 1) < bp->b_npages) db_printf(","); }