From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D8341A00BE; Sat, 13 Jun 2020 17:58:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 71A7F5F69; Sat, 13 Jun 2020 17:58:19 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 0202B4CBD; Sat, 13 Jun 2020 17:58:16 +0200 (CEST) IronPort-SDR: qLizPoESlTC3UCGQ+hweI2fjPIWsf3ucxgfddjSiZ4/wougdui3OrCgAfDgqzr4QS2U3qFxyTJ KRPHIL+J20Uw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2020 08:58:16 -0700 IronPort-SDR: OsTpodIPEL+V9p6Um937AiBJQrkfBFzjo9/if5jglusX+tvCghusrOjK8rEWeAB3JU8GW/Kx3h HnscAheuy3JA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,507,1583222400"; d="scan'208";a="448663731" Received: from yexl-server.sh.intel.com ([10.67.116.183]) by orsmga005.jf.intel.com with ESMTP; 13 Jun 2020 08:58:14 -0700 From: Xiaolong Ye To: Olivier Matz , Konstantin Ananyev , Thomas Monjalon Cc: dev@dpdk.org, Xiaolong Ye , stable@dpdk.org Date: Sat, 13 Jun 2020 23:49:18 +0800 Message-Id: <20200613154922.42379-3-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200613154922.42379-1-xiaolong.ye@intel.com> References: <20200613154922.42379-1-xiaolong.ye@intel.com> Subject: [dpdk-dev] [PATCH 2/5] mbuf: fix missing errno for dyn field/flag registration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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