From 1f22fabdfb9ac1f283bceaf47112c4f4fb29da43 Mon Sep 17 00:00:00 2001 From: Weongyo Jeong Date: Wed, 11 Jun 2008 07:55:07 +0000 Subject: [PATCH] fix a page fault that it occurred during ifp is NULL. This bug happens when NDIS driver's initialization is failed and NDIS driver's trying to call NdisWriteErrorLogEntry(). --- sys/compat/ndis/subr_ndis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index 2945386d27a7..3e4470e5475c 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -1018,7 +1018,7 @@ NdisWriteErrorLogEntry(ndis_handle adapter, ndis_error_code code, sc = device_get_softc(dev); ifp = sc->ifp; - if (ifp->if_flags & IFF_DEBUG) { + if (ifp != NULL && ifp->if_flags & IFF_DEBUG) { error = pe_get_message((vm_offset_t)drv->dro_driverstart, code, &str, &i, &flags); if (error == 0) { @@ -1036,7 +1036,7 @@ NdisWriteErrorLogEntry(ndis_handle adapter, ndis_error_code code, device_printf (dev, "NDIS ERROR: %x (%s)\n", code, str == NULL ? "unknown error" : str); - if (ifp->if_flags & IFF_DEBUG) { + if (ifp != NULL && ifp->if_flags & IFF_DEBUG) { device_printf (dev, "NDIS NUMERRORS: %x\n", numerrors); va_start(ap, numerrors); for (i = 0; i < numerrors; i++)