DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaolong Ye <xiaolong.ye@intel.com>
To: Olivier Matz <olivier.matz@6wind.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Xiaolong Ye <xiaolong.ye@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/5] mbuf: fix missing errno for dyn field/flag registration
Date: Sat, 13 Jun 2020 23:49:18 +0800
Message-ID: <20200613154922.42379-3-xiaolong.ye@intel.com> (raw)
In-Reply-To: <20200613154922.42379-1-xiaolong.ye@intel.com>

Set rte_errno as ENOMEM when allocation failure.

Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 lib/librte_mbuf/rte_mbuf_dyn.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c
index 13d6da6d16..de7d2eb9a5 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.c
+++ b/lib/librte_mbuf/rte_mbuf_dyn.c
@@ -278,12 +278,15 @@ __rte_mbuf_dynfield_register_offset(const struct rte_mbuf_dynfield *params,
 		mbuf_dynfield_tailq.head, mbuf_dynfield_list);
 
 	te = rte_zmalloc("MBUF_DYNFIELD_TAILQ_ENTRY", sizeof(*te), 0);
-	if (te == NULL)
+	if (te == NULL) {
+		rte_errno = ENOMEM;
 		return -1;
+	}
 
 	mbuf_dynfield = rte_zmalloc("mbuf_dynfield", sizeof(*mbuf_dynfield), 0);
 	if (mbuf_dynfield == NULL) {
 		rte_free(te);
+		rte_errno = ENOMEM;
 		return -1;
 	}
 
@@ -456,12 +459,15 @@ __rte_mbuf_dynflag_register_bitnum(const struct rte_mbuf_dynflag *params,
 		mbuf_dynflag_tailq.head, mbuf_dynflag_list);
 
 	te = rte_zmalloc("MBUF_DYNFLAG_TAILQ_ENTRY", sizeof(*te), 0);
-	if (te == NULL)
+	if (te == NULL) {
+		rte_errno = ENOMEM;
 		return -1;
+	}
 
 	mbuf_dynflag = rte_zmalloc("mbuf_dynflag", sizeof(*mbuf_dynflag), 0);
 	if (mbuf_dynflag == NULL) {
 		rte_free(te);
+		rte_errno = ENOMEM;
 		return -1;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2020-06-13 15:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-13 15:49 [dpdk-dev] [PATCH 0/5] small fixes for mbuf's dynamic field/flag feature Xiaolong Ye
2020-06-13 15:49 ` [dpdk-dev] [PATCH 1/5] mbuf: fix out-of-bounds access at dyn field register Xiaolong Ye
2020-06-13 15:49 ` Xiaolong Ye [this message]
2020-06-25 15:31   ` [dpdk-dev] [PATCH 2/5] mbuf: fix missing errno for dyn field/flag registration Olivier Matz
2020-06-13 15:49 ` [dpdk-dev] [PATCH 3/5] mbuf: fix free_space setting for dynamic field Xiaolong Ye
2020-06-25 15:53   ` Olivier Matz
2020-06-13 15:49 ` [dpdk-dev] [PATCH 4/5] mbuf: fix a dynamic field dump log Xiaolong Ye
2020-06-25 15:54   ` Olivier Matz
2020-06-13 15:49 ` [dpdk-dev] [PATCH 5/5] mbuf: support to dump free_flags for dynamic flag Xiaolong Ye
2020-06-25 15:55   ` Olivier Matz
2020-06-25 20:40 ` [dpdk-dev] [PATCH 0/5] small fixes for mbuf's dynamic field/flag feature Thomas Monjalon

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=20200613154922.42379-3-xiaolong.ye@intel.com \
    --to=xiaolong.ye@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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