[dpdk-dev] [PATCH 1/1] net/cxgbe: check return value of malloc
caihe
caihe at huawei.com
Sat Mar 25 13:44:29 CET 2017
Hi rahul,
There is a bug without check the return value of alloc memory in function t4_wr_mbox_meat_timeout, if we should fix it as below:
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index c089b06..7402a5f 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -359,6 +359,10 @@ 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;
Best Regards
More information about the dev
mailing list