patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] net/hinic: fix return value of null not checked
@ 2020-07-28 12:34 wangyunjian
  2020-07-28 13:34 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: wangyunjian @ 2020-07-28 12:34 UTC (permalink / raw)
  To: dev
  Cc: cloud.wangxiaoyun, zhouguoyang, jerry.lilijun, xudingke,
	Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

The function rte_zmalloc() could return NULL, the return
value need to be checked.

Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/hinic/hinic_pmd_flow.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
index a7bad570b..503a32fff 100644
--- a/drivers/net/hinic/hinic_pmd_flow.c
+++ b/drivers/net/hinic/hinic_pmd_flow.c
@@ -2977,6 +2977,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
 		if (!ret) {
 			ntuple_filter_ptr = rte_zmalloc("hinic_ntuple_filter",
 				sizeof(struct hinic_ntuple_filter_ele), 0);
+			if (ntuple_filter_ptr == NULL) {
+				PMD_DRV_LOG(ERR, "Failed to allocate ntuple_filter_ptr");
+				goto out;
+			}
 			rte_memcpy(&ntuple_filter_ptr->filter_info,
 				   &ntuple_filter,
 				   sizeof(struct rte_eth_ntuple_filter));
@@ -3003,6 +3007,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
 			ethertype_filter_ptr =
 				rte_zmalloc("hinic_ethertype_filter",
 				sizeof(struct hinic_ethertype_filter_ele), 0);
+			if (ethertype_filter_ptr == NULL) {
+				PMD_DRV_LOG(ERR, "Failed to allocate ethertype_filter_ptr");
+				goto out;
+			}
 			rte_memcpy(&ethertype_filter_ptr->filter_info,
 				&ethertype_filter,
 				sizeof(struct rte_eth_ethertype_filter));
@@ -3036,6 +3044,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
 		if (!ret) {
 			fdir_rule_ptr = rte_zmalloc("hinic_fdir_rule",
 				sizeof(struct hinic_fdir_rule_ele), 0);
+			if (fdir_rule_ptr == NULL) {
+				PMD_DRV_LOG(ERR, "Failed to allocate fdir_rule_ptr");
+				goto out;
+			}
 			rte_memcpy(&fdir_rule_ptr->filter_info, &fdir_rule,
 				sizeof(struct hinic_fdir_rule));
 			TAILQ_INSERT_TAIL(&nic_dev->filter_fdir_rule_list,
-- 
2.23.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [PATCH] net/hinic: fix return value of null not checked
  2020-07-28 12:34 [dpdk-stable] [PATCH] net/hinic: fix return value of null not checked wangyunjian
@ 2020-07-28 13:34 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2020-07-28 13:34 UTC (permalink / raw)
  To: wangyunjian, dev
  Cc: cloud.wangxiaoyun, zhouguoyang, jerry.lilijun, xudingke, stable

On 7/28/2020 1:34 PM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The function rte_zmalloc() could return NULL, the return
> value need to be checked.
> 
> Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 12:34 [dpdk-stable] [PATCH] net/hinic: fix return value of null not checked wangyunjian
2020-07-28 13:34 ` Ferruh Yigit

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox