DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix potential out of bounds read
@ 2015-03-09 13:21 Julien Cretin
  2015-03-23 11:36 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Cretin @ 2015-03-09 13:21 UTC (permalink / raw)
  To: dev

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

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix potential out of bounds read
  2015-03-09 13:21 [dpdk-dev] [PATCH] app/testpmd: fix potential out of bounds read Julien Cretin
@ 2015-03-23 11:36 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-03-23 11:36 UTC (permalink / raw)
  To: Julien Cretin; +Cc: dev

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

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied, thanks

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

end of thread, other threads:[~2015-03-23 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 13:21 [dpdk-dev] [PATCH] app/testpmd: fix potential out of bounds read Julien Cretin
2015-03-23 11:36 ` 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).