DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jiajia, SunX" <sunx.jiajia@intel.com>
To: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] pcap: Fixed bug in eth_pcap_rx function
Date: Tue, 12 Aug 2014 02:29:48 +0000	[thread overview]
Message-ID: <F21F274FCF2C0948830A3ED003452977180210@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1407233900-9734-1-git-send-email-pablo.de.lara.guarch@intel.com>

Tested-by: Jiajia SunX   <sunx.jiajia@intel.com>

This patch fixed a bug by changing eth_pcap_rx function, and is ready to integrate into DPDK.org.

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Tuesday, August 05, 2014 6:18 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] pcap: Fixed bug in eth_pcap_rx function
> 
> Normally, bufs[i] stores the mbuf pointer, the index of buf[i]
> is the loop count i, but if header.len > buf_size, DPDK will
> free the mbuf, but the loop count i still increases, so some
> of the items in bufs[] might be NULL ponter, causing a potential
> DPDK core. Using num_rx as the index for bufs[] solves the problem.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  lib/librte_pmd_pcap/rte_eth_pcap.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c
> b/lib/librte_pmd_pcap/rte_eth_pcap.c
> index c77ee25..eebe768 100644
> --- a/lib/librte_pmd_pcap/rte_eth_pcap.c
> +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
> @@ -154,7 +154,7 @@ eth_pcap_rx(void *queue,
>  			rte_memcpy(mbuf->pkt.data, packet, header.len);
>  			mbuf->pkt.data_len = (uint16_t)header.len;
>  			mbuf->pkt.pkt_len = mbuf->pkt.data_len;
> -			bufs[i] = mbuf;
> +			bufs[num_rx] = mbuf;
>  			num_rx++;
>  		} else {
>  			/* pcap packet will not fit in the mbuf, so drop
> packet */
> --
> 1.7.0.7

  reply	other threads:[~2014-08-12  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 10:18 Pablo de Lara
2014-08-12  2:29 ` Jiajia, SunX [this message]
2014-08-12 23:29   ` 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=F21F274FCF2C0948830A3ED003452977180210@SHSMSX104.ccr.corp.intel.com \
    --to=sunx.jiajia@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).