From 4a8f7cdd2281c7d904eae5b5ee92e4214e945e51 Mon Sep 17 00:00:00 2001 From: Henry Cai Date: Tue, 28 Mar 2017 15:32:20 +0800 Subject: [PATCH] net/cxgbe: fix possible null pointer dereference 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 Acked-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/t4_hw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index c089b068d2..9dca8da16d 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -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; -- 2.20.1