brcm80211: smac: eliminate a null pointer dereference in dma.c
authorArend van Spriel <[email protected]>
Sat, 29 Oct 2011 09:30:15 +0000 (11:30 +0200)
committerJohn W. Linville <[email protected]>
Mon, 7 Nov 2011 18:19:13 +0000 (13:19 -0500)
Though it's unlikely, di may be null, so we can't dereference
di->dma.dmactrlflags until we've checked it.

Move this de-reference after the check, and adjust the error
message to not require de-referencing di.

This is based upon Julia's original patch:
<1319846297[email protected]>

Reported-by: Julia Lawall <[email protected]>
Acked-by: Arend van Spriel <[email protected]>
Signed-off-by: Julian Calaby <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
drivers/net/wireless/brcm80211/brcmsmac/dma.c

index b56a30297c269712840a8696f77d1d84daab358a..6ebec8f42846977439c07844cba9a6f7e429801c 100644 (file)
@@ -358,13 +358,14 @@ static uint nrxdactive(struct dma_info *di, uint h, uint t)
 
 static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
 {
-       uint dmactrlflags = di->dma.dmactrlflags;
+       uint dmactrlflags;
 
        if (di == NULL) {
-               DMA_ERROR(("%s: _dma_ctrlflags: NULL dma handle\n", di->name));
+               DMA_ERROR(("_dma_ctrlflags: NULL dma handle\n"));
                return 0;
        }
 
+       dmactrlflags = di->dma.dmactrlflags;
        dmactrlflags &= ~mask;
        dmactrlflags |= flags;