All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yong Wang <wang.yong19@zte.com.cn>
To: beilei.xing@intel.com, wenzhuo.lu@intel.com, fiona.trahe@intel.com
Cc: dev@dpdk.org, Yong Wang <wang.yong19@zte.com.cn>
Subject: [PATCH v3 2/3] net/e1000: add null point check for rte_zmalloc
Date: Mon, 22 Jan 2018 21:44:59 -0500	[thread overview]
Message-ID: <1516675500-10878-2-git-send-email-wang.yong19@zte.com.cn> (raw)
In-Reply-To: <1516675500-10878-1-git-send-email-wang.yong19@zte.com.cn>

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
 drivers/net/e1000/igb_flow.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index d98bdc8..a142759 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -1413,6 +1413,11 @@
 		if (!ret) {
 			ntuple_filter_ptr = rte_zmalloc("igb_ntuple_filter",
 				sizeof(struct igb_ntuple_filter_ele), 0);
+			if (!ntuple_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&ntuple_filter_ptr->filter_info,
 				&ntuple_filter,
 				sizeof(struct rte_eth_ntuple_filter));
@@ -1435,6 +1440,11 @@
 			ethertype_filter_ptr = rte_zmalloc(
 				"igb_ethertype_filter",
 				sizeof(struct igb_ethertype_filter_ele), 0);
+			if (!ethertype_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&ethertype_filter_ptr->filter_info,
 				&ethertype_filter,
 				sizeof(struct rte_eth_ethertype_filter));
@@ -1455,6 +1465,11 @@
 		if (!ret) {
 			syn_filter_ptr = rte_zmalloc("igb_syn_filter",
 				sizeof(struct igb_eth_syn_filter_ele), 0);
+			if (!syn_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&syn_filter_ptr->filter_info,
 				&syn_filter,
 				sizeof(struct rte_eth_syn_filter));
@@ -1476,6 +1491,11 @@
 		if (!ret) {
 			flex_filter_ptr = rte_zmalloc("igb_flex_filter",
 				sizeof(struct igb_flex_filter_ele), 0);
+			if (!flex_filter_ptr) {
+				PMD_DRV_LOG(ERR, "failed to allocate memory");
+				goto out;
+			}
+
 			rte_memcpy(&flex_filter_ptr->filter_info,
 				&flex_filter,
 				sizeof(struct rte_eth_flex_filter));
-- 
1.8.3.1

  reply	other threads:[~2018-01-23  3:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23  2:44 [PATCH v3 1/3] net/i40e: add null point check and fix mem leak Yong Wang
2018-01-23  2:44 ` Yong Wang [this message]
2018-01-23  2:45 ` [PATCH v3 3/3] crypto/qat: " Yong Wang
2018-01-23 12:16   ` Trahe, Fiona
2018-01-23 12:16   ` [PATCH v3 3/3] crypto/qat: hebing " Trahe, Fiona
2018-01-24  8:41 ` [PATCH v3 1/3] net/i40e: " Zhang, Helin
2018-01-24  9:28   ` 答复: RE: [PATCH v3 1/3] net/i40e: add null point check andfix " wang.yong19

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516675500-10878-2-git-send-email-wang.yong19@zte.com.cn \
    --to=wang.yong19@zte.com.cn \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.