提交 ae8e4672 编写于 作者: A Arend van Spriel 提交者: John W. Linville

brcm80211: smac: eliminate a null pointer dereference in dma.c

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-2985-2-git-send-email-julia@diku.dk>
Reported-by: NJulia Lawall <julia@diku.dk>
Acked-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NJulian Calaby <julian.calaby@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 73d51f38
...@@ -358,13 +358,14 @@ static uint nrxdactive(struct dma_info *di, uint h, uint t) ...@@ -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) static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
{ {
uint dmactrlflags = di->dma.dmactrlflags; uint dmactrlflags;
if (di == NULL) { if (di == NULL) {
DMA_ERROR(("%s: _dma_ctrlflags: NULL dma handle\n", di->name)); DMA_ERROR(("_dma_ctrlflags: NULL dma handle\n"));
return 0; return 0;
} }
dmactrlflags = di->dma.dmactrlflags;
dmactrlflags &= ~mask; dmactrlflags &= ~mask;
dmactrlflags |= flags; dmactrlflags |= flags;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册