DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test: fix memory_autotest integer overflow/wraparound
@ 2015-11-17 15:39 Sergio Gonzalez Monroy
  2015-12-02 11:49 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Sergio Gonzalez Monroy @ 2015-11-17 15:39 UTC (permalink / raw)
  To: dev

memory_autotest loops infinitely when at least one the memsegs
is bigger than 4GB.

The issue is the result of an integer overflow/wraparound of
the offset variable.

Fix it by using the correct type (size_t).

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
 app/test/test_memory.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test/test_memory.c b/app/test/test_memory.c
index 02ef3cf..6816385 100644
--- a/app/test/test_memory.c
+++ b/app/test/test_memory.c
@@ -55,7 +55,8 @@ static int
 test_memory(void)
 {
 	uint64_t s;
-	unsigned i, j;
+	unsigned i;
+	size_t j;
 	const struct rte_memseg *mem;
 
 	/*
-- 
2.4.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-07  2:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-17 15:39 [dpdk-dev] [PATCH] app/test: fix memory_autotest integer overflow/wraparound Sergio Gonzalez Monroy
2015-12-02 11:49 ` De Lara Guarch, Pablo
2015-12-07  2:46   ` Thomas Monjalon

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).