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 /test/performance | |
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 'test/performance')
-rw-r--r-- | test/performance/odp_l2fwd.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 9cc201f81..a408c7d78 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -231,6 +231,7 @@ static void *pktio_ifburst_thread(void *arg) if (pkts_ok > 0) { int sent = odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok); + sent = sent > 0 ? sent : 0; if (odp_unlikely(sent < pkts_ok)) { stats->drops += pkts_ok - sent; do |