examples/ipsec-secgw: fix out-of-bound check
authorKonstantin Ananyev <konstantin.ananyev@intel.com>
Wed, 27 Mar 2019 09:33:27 +0000 (09:33 +0000)
committerAkhil Goyal <akhil.goyal@nxp.com>
Tue, 2 Apr 2019 14:50:24 +0000 (16:50 +0200)
Coverity issue: 336791
Fixes: 7622291b641d ("examples/ipsec-secgw: allow to specify neighbour MAC address")
Cc: stable@dpdk.org
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
examples/ipsec-secgw/ipsec-secgw.c

index b253eea..ffbd00b 100644 (file)
@@ -1439,7 +1439,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr)
 int
 add_dst_ethaddr(uint16_t port, const struct ether_addr *addr)
 {
-       if (port > RTE_DIM(ethaddr_tbl))
+       if (port >= RTE_DIM(ethaddr_tbl))
                return -EINVAL;
 
        ethaddr_tbl[port].dst = ETHADDR_TO_UINT64(addr);