iwm - Fix possible null pointer indirection
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 26 Dec 2018 06:17:25 +0000 (22:17 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 26 Dec 2018 06:17:25 +0000 (22:17 -0800)
* 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
sys/dev/netif/iwm/if_iwm.c

index 6f869b1..309ad6a 100644 (file)
@@ -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