diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-07-16 19:10:55 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-07-17 13:01:09 +0300 |
commit | d2b3247f56570cdeee0da660075bbe2fb8647d90 (patch) | |
tree | 7ea64c4da8038e3913762cac12aebd73088b5b2e /example | |
parent | 6f576b186f311d12ef6cfa8b46c395a3351a9fdf (diff) |
test: do not use negative array index
odp_pktio_send() can return -1 error and that return code
can be used as array index in code bellow. On error just
increase drop counter and free packets.
https://bugs.linaro.org/show_bug.cgi?id=1688
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofe@linaro.org>
Diffstat (limited to 'example')
-rw-r--r-- | example/packet/odp_pktio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 8004d69..040571b 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -291,6 +291,7 @@ static void *pktio_ifburst_thread(void *arg) /* Swap Eth MACs and IP-addrs */ swap_pkt_addrs(pkt_tbl, pkts_ok); sent = odp_pktio_send(pktio, pkt_tbl, pkts_ok); + sent = sent > 0 ? sent : 0; if (odp_unlikely(sent < pkts_ok)) { err_cnt += pkts_ok - sent; do |