From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 449387DF0 for ; Thu, 18 Dec 2014 22:15:16 +0100 (CET) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1Y1iPh-0001Ub-83; Thu, 18 Dec 2014 16:15:15 -0500 Date: Thu, 18 Dec 2014 16:15:12 -0500 From: Neil Horman To: Daniel Mrzyglod Message-ID: <20141218211512.GI18008@hmsreliant.think-freely.org> References: <1418895905-915-1-git-send-email-danielx.t.mrzyglod@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1418895905-915-1-git-send-email-danielx.t.mrzyglod@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] af_packet: fix memory allocation check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Dec 2014 21:15:16 -0000 On Thu, Dec 18, 2014 at 09:45:05AM +0000, Daniel Mrzyglod wrote: > In rte_eth_af_packet.c we are we are missing NULL pointer > checks after calls to alocate memory for queues. Add checking NULL > pointer and error handling. > > Signed-off-by: Daniel Mrzyglod > --- > lib/librte_pmd_af_packet/rte_eth_af_packet.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > index ad7242c..236749b 100644 > --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c > +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > @@ -603,6 +603,8 @@ rte_pmd_init_internals(const char *name, > rdsize = req->tp_frame_nr * sizeof(*(rx_queue->rd)); > > rx_queue->rd = rte_zmalloc_socket(name, rdsize, 0, numa_node); > + if (rx_queue->rd == NULL) > + goto error; > for (i = 0; i < req->tp_frame_nr; ++i) { > rx_queue->rd[i].iov_base = rx_queue->map + (i * framesize); > rx_queue->rd[i].iov_len = req->tp_frame_size; > @@ -615,6 +617,8 @@ rte_pmd_init_internals(const char *name, > tx_queue->map = rx_queue->map + req->tp_block_size * req->tp_block_nr; > > tx_queue->rd = rte_zmalloc_socket(name, rdsize, 0, numa_node); > + if (tx_queue->rd == NULL) > + goto error; > for (i = 0; i < req->tp_frame_nr; ++i) { > tx_queue->rd[i].iov_base = tx_queue->map + (i * framesize); > tx_queue->rd[i].iov_len = req->tp_frame_size; > -- > 2.1.0 > > Acked-by: Neil Horman