net/cxgbe: fix possible null pointer dereference
authorHenry Cai <caihe@huawei.com>
Tue, 28 Mar 2017 07:32:20 +0000 (15:32 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 19 Apr 2017 13:37:37 +0000 (15:37 +0200)
Check return value of malloc.

Fixes: 3bd122eef2cc ("cxgbe/base: add hardware API for Chelsio T5 series adapters")
Cc: stable@dpdk.org
Signed-off-by: Henry Cai <caihe@huawei.com>
Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
drivers/net/cxgbe/base/t4_hw.c

index c089b06..9dca8da 100644 (file)
@@ -359,6 +359,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
        struct mbox_entry entry;
        u32 pcie_fw = 0;
 
+       if (!temp)
+               return -ENOMEM;
+
        if ((size & 15) || size > MBOX_LEN) {
                free(temp);
                return -EINVAL;