From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 28C091F1A for ; Mon, 22 Jan 2018 17:42:08 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 08:42:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,397,1511856000"; d="scan'208";a="12263021" Received: from silpixa00383879.ir.intel.com (HELO silpixa00383879.ger.corp.intel.com) ([10.237.223.127]) by fmsmga008.fm.intel.com with ESMTP; 22 Jan 2018 08:42:06 -0800 From: Radu Nicolau To: dev@dpdk.org Cc: marko.kovacevic@intel.com, john.mcnamara@intel.com, declan.doherty@intel.com, Radu Nicolau Date: Mon, 22 Jan 2018 16:36:56 +0000 Message-Id: <1516639016-28269-1-git-send-email-radu.nicolau@intel.com> X-Mailer: git-send-email 2.7.5 Subject: [dpdk-dev] [PATCH] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2018 16:42:09 -0000 Fixes Coverity issue 257008 Signed-off-by: Radu Nicolau --- 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