From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <radu.nicolau@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 96C4723B;
 Wed, 24 Jan 2018 14:22:07 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 24 Jan 2018 05:22:06 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.46,407,1511856000"; d="scan'208";a="24349249"
Received: from silpixa00383879.ir.intel.com (HELO
 silpixa00383879.ger.corp.intel.com) ([10.237.223.127])
 by fmsmga004.fm.intel.com with ESMTP; 24 Jan 2018 05:22:05 -0800
From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: marko.kovacevic@intel.com, john.mcnamara@intel.com,
 declan.doherty@intel.com, Radu Nicolau <radu.nicolau@intel.com>,
 stable@dpdk.org
Date: Wed, 24 Jan 2018 13:16:46 +0000
Message-Id: <1516799806-16571-1-git-send-email-radu.nicolau@intel.com>
X-Mailer: git-send-email 2.7.5
In-Reply-To: <1516639016-28269-1-git-send-email-radu.nicolau@intel.com>
References: <1516639016-28269-1-git-send-email-radu.nicolau@intel.com>
Subject: [dpdk-dev] [PATCH v2] examples/bond: add mbuf alloc check
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jan 2018 13:22:08 -0000

Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")
Coverity issue: 257008
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2: updated commit message

 examples/bond/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 01e5eda..6c8a44a 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -441,6 +441,11 @@ static void cmd_obj_send_parsed(void *parsed_result,
 				(BOND_IP_3 << 16) | (BOND_IP_4 << 24);
 
 	created_pkt = rte_pktmbuf_alloc(mbuf_pool);
+	if (created_pkt == NULL) {
+		cmdline_printf(cl, "Failed to allocate mbuf\n");
+		return;
+	}
+
 	pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr);
 	created_pkt->data_len = pkt_size;
 	created_pkt->pkt_len = pkt_size;
-- 
2.7.5