From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/3] ixgbe: prevent array overflow access in vector driver
Date: Tue, 16 Dec 2014 16:30:23 +0000 [thread overview]
Message-ID: <1418747424-22254-3-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1418747424-22254-1-git-send-email-bruce.richardson@intel.com>
Switch the order of the conditions in a while loop, so we check the
range of "i" against the max, before using it to index into the array.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
index 3a30fa7..b54cb19 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
@@ -489,7 +489,7 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
unsigned i = 0;
if (rxq->pkt_first_seg == NULL) {
/* find the first split flag, and only reassemble then*/
- while (!split_flags[i] && i < nb_bufs)
+ while (i < nb_bufs && !split_flags[i])
i++;
if (i == nb_bufs)
return nb_bufs;
--
1.9.3
next prev parent reply other threads:[~2014-12-16 16:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 16:30 [dpdk-dev] [PATCH 0/3] (More) Fixes for issues highlighted by static analysis Bruce Richardson
2014-12-16 16:30 ` [dpdk-dev] [PATCH 1/3] af_packet: ensure *internals is not null when dereferencing Bruce Richardson
2014-12-16 16:30 ` Bruce Richardson [this message]
2014-12-16 16:30 ` [dpdk-dev] [PATCH 3/3] eal: for safety, use snprintf instead of sprintf Bruce Richardson
2014-12-16 23:52 ` [dpdk-dev] [PATCH 0/3] (More) Fixes for issues highlighted by static analysis 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=1418747424-22254-3-git-send-email-bruce.richardson@intel.com \
--to=bruce.richardson@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 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).