From: Julien Cretin <julien.cretin@trust-in-soft.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix potential out of bounds read
Date: Mon, 9 Mar 2015 14:21:09 +0100 [thread overview]
Message-ID: <1425907269-20856-1-git-send-email-julien.cretin@trust-in-soft.com> (raw)
After the last enabled port has been seen, and the last time we
evaluate the loop condition, there is an out of bounds read in
ports[p].enabled because p is equal to size, which is the length of
ports.
Signed-off-by: Julien Cretin <julien.cretin@trust-in-soft.com>
---
app/test-pmd/testpmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 3e1327e..a9d15f3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -333,7 +333,7 @@ find_next_port(portid_t p, struct rte_port *ports, int size)
if (ports == NULL)
rte_exit(-EINVAL, "failed to find a next port id\n");
- while ((ports[p].enabled == 0) && (p < size))
+ while ((p < size) && (ports[p].enabled == 0))
p++;
return p;
}
--
1.9.1
next reply other threads:[~2015-03-09 13:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 13:21 Julien Cretin [this message]
2015-03-23 11:36 ` 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=1425907269-20856-1-git-send-email-julien.cretin@trust-in-soft.com \
--to=julien.cretin@trust-in-soft.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 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).