All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eli Britstein <elibr@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>, Asaf Penso <asafp@nvidia.com>,
	"Slava Ovsiienko" <viacheslavo@nvidia.com>,
	Thomas Monjalon <thomas@monjalon.net>, <xiaoyun.li@intel.com>,
	<anatoly.burakov@intel.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Eli Britstein <elibr@nvidia.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH V2 1/1] app/testpmd: fix packet burst spreading stats
Date: Thu, 21 Oct 2021 16:20:02 +0300	[thread overview]
Message-ID: <20211021132002.26231-1-elibr@nvidia.com> (raw)
In-Reply-To: <20211021080310.9892-1-elibr@nvidia.com>

RX/TX functions (rte_eth_rx_burst/rte_eth_tx_burst) get 'nb_pkts'
argument, which specifies the maximum number to receive/transmit.
It can be 0..nb_pkts, meaning nb_pkts+1 options.
Testpmd can provide statistics of the burst sizes ('set
record-burst-stats on') by incrementing an array cell of index
<burst-size>. This array is mistakenly [MAX_PKT_BURST] size. Receiving
the maximum burst will cause out of bound write.
Enlarge the spread stats array by one cell to fix it.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test-pmd/testpmd.c | 2 +-
 app/test-pmd/testpmd.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index af0e79fe6d..d75451ac7b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1873,7 +1873,7 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
 	pktnb_stats[0] = 0;
 
 	/* Find the next 2 burst sizes with highest occurrences. */
-	for (nb_pkt = 1; nb_pkt < MAX_PKT_BURST; nb_pkt++) {
+	for (nb_pkt = 1; nb_pkt < MAX_PKT_BURST + 1; nb_pkt++) {
 		nb_burst = pbs->pkt_burst_spread[nb_pkt];
 
 		if (nb_burst == 0)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e3995d24ab..5238308ca7 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -96,7 +96,7 @@ enum {
  * that are recorded for each forwarding stream.
  */
 struct pkt_burst_stats {
-	unsigned int pkt_burst_spread[MAX_PKT_BURST];
+	unsigned int pkt_burst_spread[MAX_PKT_BURST + 1];
 };
 
 /** Information for a given RSS type. */
-- 
2.28.0.2311.g225365fb51


  parent reply	other threads:[~2021-10-21 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  8:03 [dpdk-dev] [PATCH] app/testpmd: fix packet burst spreading stats Eli Britstein
2021-10-21 12:46 ` Ferruh Yigit
2021-10-21 13:20 ` Eli Britstein [this message]
2021-10-22  2:25   ` [dpdk-dev] [PATCH V2 1/1] " Ferruh Yigit

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=20211021132002.26231-1-elibr@nvidia.com \
    --to=elibr@nvidia.com \
    --cc=anatoly.burakov@intel.com \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    --cc=xiaoyun.li@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.