]> Git Repo - linux.git/commitdiff
i40iw: Add NULL check for puda buffer
authorMustafa Ismail <[email protected]>
Tue, 12 Jul 2016 16:48:46 +0000 (11:48 -0500)
committerDoug Ledford <[email protected]>
Tue, 2 Aug 2016 18:17:38 +0000 (14:17 -0400)
i40iw_puda_get_listbuf may return NULL if the list is empty.
Add NULL check prior to accessing the pointer.

Signed-off-by: Mustafa Ismail <[email protected]>
Signed-off-by: Shiraz Saleem <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
drivers/infiniband/hw/i40iw/i40iw_puda.c

index e9c6e82af9c7a07a8bb3d256007f297fcd61aa15..c62d354f78102c6e31ff8b65aae4a1be9c021948 100644 (file)
@@ -1025,6 +1025,8 @@ static void  i40iw_ieq_compl_pfpdu(struct i40iw_puda_rsrc *ieq,
        u16 txoffset, bufoffset;
 
        buf = i40iw_puda_get_listbuf(pbufl);
+       if (!buf)
+               return;
        nextseqnum = buf->seqnum + fpdu_len;
        txbuf->totallen = buf->hdrlen + fpdu_len;
        txbuf->data = (u8 *)txbuf->mem.va + buf->hdrlen;
@@ -1048,6 +1050,8 @@ static void  i40iw_ieq_compl_pfpdu(struct i40iw_puda_rsrc *ieq,
                fpdu_len -= buf->datalen;
                i40iw_puda_ret_bufpool(ieq, buf);
                buf = i40iw_puda_get_listbuf(pbufl);
+               if (!buf)
+                       return;
                bufoffset = (u16)(buf->data - (u8 *)buf->mem.va);
        } while (1);
 
This page took 0.05789 seconds and 4 git commands to generate.