All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
To: dev@dpdk.org
Subject: [PATCH] app/test: fix memory_autotest integer overflow/wraparound
Date: Tue, 17 Nov 2015 15:39:16 +0000	[thread overview]
Message-ID: <1447774756-107404-1-git-send-email-sergio.gonzalez.monroy@intel.com> (raw)

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

             reply	other threads:[~2015-11-17 15:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 15:39 Sergio Gonzalez Monroy [this message]
2015-12-02 11:49 ` [PATCH] app/test: fix memory_autotest integer overflow/wraparound De Lara Guarch, Pablo
2015-12-07  2:46   ` 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=1447774756-107404-1-git-send-email-sergio.gonzalez.monroy@intel.com \
    --to=sergio.gonzalez.monroy@intel.com \
    --cc=dev@dpdk.org \
    /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.