From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, aconole@redhat.com, msantana@redhat.com,
stable@dpdk.org, Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-stable] [PATCH 07/14] test/latencystats: fix stack smashing
Date: Tue, 4 Jun 2019 10:59:45 +0200 [thread overview]
Message-ID: <1559638792-8608-8-git-send-email-david.marchand@redhat.com> (raw)
In-Reply-To: <1559638792-8608-1-git-send-email-david.marchand@redhat.com>
Caught in one Travis run:
+ ------------------------------------------------------- +
+ Test Suite : Latency Stats Unit Test Suite
+ ------------------------------------------------------- +
+ TestCase [ 0] : test_latency_init succeeded
+ TestCase [ 1] : test_latency_update succeeded
[snip]
+ TestCase [1601724781] : test_latencystats_get_names succeeded
[snip]
+ Tests Failed : 1601790830
htonl(1601724781) -> "m", "a", "x", "_"
htonl(1601790830) -> "n", "c", "y", "_"
Looks like someone went too far.
The test passes a bigger size than the array it passes along.
Fixes: 1e3676a06e4c ("test/latency: add unit tests for latencystats library")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
app/test/test_latencystats.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/app/test/test_latencystats.c b/app/test/test_latencystats.c
index 039c508..8dd794b 100644
--- a/app/test/test_latencystats.c
+++ b/app/test/test_latencystats.c
@@ -69,13 +69,10 @@ static int test_latencystats_get_names(void)
int ret = 0, i = 0;
int size = 0;
struct rte_metric_name names[NUM_STATS];
- struct rte_metric_name wrongnames[NUM_STATS - 2];
size_t m_size = sizeof(struct rte_metric_name);
for (i = 0; i < NUM_STATS; i++)
memset(&names[i], 0, m_size);
- for (i = 0; i < NUM_STATS - 2; i++)
- memset(&wrongnames[i], 0, m_size);
/* Success Test: Valid names and size */
size = NUM_STATS;
@@ -99,10 +96,6 @@ static int test_latencystats_get_names(void)
TEST_ASSERT((ret == NUM_STATS), "Test Failed to get the metrics count,"
"Actual: %d Expected: %d", ret, NUM_STATS);
- /* Failure Test: Invalid names (array size lesser than size) */
- size = NUM_STATS + 1;
- ret = rte_latencystats_get_names(wrongnames, size);
- TEST_ASSERT((ret == NUM_STATS), "Test Failed to get metrics names");
return TEST_SUCCESS;
}
@@ -112,13 +105,10 @@ static int test_latencystats_get(void)
int ret = 0, i = 0;
int size = 0;
struct rte_metric_value values[NUM_STATS];
- struct rte_metric_value wrongvalues[NUM_STATS - 2];
size_t v_size = sizeof(struct rte_metric_value);
for (i = 0; i < NUM_STATS; i++)
memset(&values[i], 0, v_size);
- for (i = 0; i < NUM_STATS - 2; i++)
- memset(&wrongvalues[i], 0, v_size);
/* Success Test: Valid values and valid size */
size = NUM_STATS;
@@ -137,14 +127,6 @@ static int test_latencystats_get(void)
TEST_ASSERT((ret == NUM_STATS), "Test Failed to get the stats count,"
"Actual: %d Expected: %d", ret, NUM_STATS);
- /* Failure Test: Invalid values(array size lesser than size)
- * and invalid size
- */
- size = NUM_STATS + 2;
- ret = rte_latencystats_get(wrongvalues, size);
- TEST_ASSERT(ret == NUM_STATS, "Test Failed to get latency metrics"
- " values");
-
return TEST_SUCCESS;
}
--
1.8.3.1
next prev parent reply other threads:[~2019-06-04 9:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1559638792-8608-1-git-send-email-david.marchand@redhat.com>
2019-06-04 8:59 ` [dpdk-stable] [PATCH 01/14] test/bonding: add missing sources for link bonding RSS David Marchand
2019-06-04 12:59 ` Aaron Conole
2019-06-04 8:59 ` [dpdk-stable] [PATCH 02/14] test/crypto: move tests to the driver specific list David Marchand
2019-06-04 13:00 ` Aaron Conole
2019-06-04 8:59 ` [dpdk-stable] [PATCH 03/14] test/eventdev: " David Marchand
2019-06-04 13:04 ` Aaron Conole
2019-06-04 8:59 ` [dpdk-stable] [PATCH 04/14] test/hash: fix off-by-one check on core count David Marchand
2019-06-04 13:05 ` Aaron Conole
2019-06-05 20:02 ` Wang, Yipeng1
2019-06-04 8:59 ` [dpdk-stable] [PATCH 05/14] test/hash: rectify slaveid to point to valid cores David Marchand
2019-06-05 20:02 ` Wang, Yipeng1
2019-06-04 8:59 ` [dpdk-stable] [PATCH 06/14] test/hash: clean remaining trace of scaling autotest David Marchand
2019-06-04 13:31 ` Aaron Conole
2019-06-04 8:59 ` David Marchand [this message]
2019-06-04 13:38 ` [dpdk-stable] [PATCH 07/14] test/latencystats: fix stack smashing Aaron Conole
2019-06-04 8:59 ` [dpdk-stable] [PATCH 08/14] test/stack: fix lock-free test name David Marchand
2019-06-04 13:06 ` Aaron Conole
[not found] ` <1560580950-16754-1-git-send-email-david.marchand@redhat.com>
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 01/15] test/bonding: add missing sources for link bonding RSS David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 02/15] test/crypto: move tests to the driver specific list David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 03/15] test/eventdev: " David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 04/15] test/hash: fix off-by-one check on core count David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 05/15] test/hash: rectify slaveid to point to valid cores David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 06/15] test/hash: clean remaining trace of scaling autotest David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 07/15] test/latencystats: fix stack smashing David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 08/15] test/rcu: remove arbitrary limit on max core count David Marchand
2019-06-28 12:56 ` Ferruh Yigit
2019-06-28 13:32 ` David Marchand
2019-06-15 6:42 ` [dpdk-stable] [PATCH v2 09/15] test/stack: fix lock-free test name David Marchand
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=1559638792-8608-8-git-send-email-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=aconole@redhat.com \
--cc=dev@dpdk.org \
--cc=msantana@redhat.com \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/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).