From: Matthew Dillon Date: Wed, 26 Dec 2018 06:17:25 +0000 (-0800) Subject: iwm - Fix possible null pointer indirection X-Git-Tag: v5.7.0~656 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a0fed86142b3163a25e72eca99dd978a0fd91ed7 iwm - Fix possible null pointer indirection * Fix possible null pointer indirection. No known cases for dfly but I would speculate possibly something in the error path could trigger a NULL field there. * Provisional change, may be adjusted in the future. But harmless. Taken-from: haiku Requested-by: waddlespl --- diff --git a/sys/dev/netif/iwm/if_iwm.c b/sys/dev/netif/iwm/if_iwm.c index 6f869b181a..309ad6ad62 100644 --- a/sys/dev/netif/iwm/if_iwm.c +++ b/sys/dev/netif/iwm/if_iwm.c @@ -1040,7 +1040,8 @@ iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) * The hw rx ring index in shared memory must also be cleared, * otherwise the discrepancy can cause reprocessing chaos. */ - memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); + if (sc->rxq.stat) + memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); } static void