diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-06-07 18:31:07 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-09 13:37:25 -0700 |
commit | 5270041d342de6f1e6a3b6634c1ceaa67d1f87ea (patch) | |
tree | e822fa9d52aa7e6251996af9974b0b20f3b106da | |
parent | 90b8b7e755db648de7f1d17e3729dd7154a046a0 (diff) |
nexthop: off by one in nexthop_mpath_select()
The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it
has nhg->num_nh elements so this check should be >= instead of >.
Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/nexthop.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/nexthop.h b/include/net/nexthop.h index aff7b2410057..e019ed9b3dc3 100644 --- a/include/net/nexthop.h +++ b/include/net/nexthop.h @@ -160,7 +160,7 @@ struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel) /* for_nexthops macros in fib_semantics.c grabs a pointer to * the nexthop before checking nhsel */ - if (nhsel > nhg->num_nh) + if (nhsel >= nhg->num_nh) return NULL; return nhg->nh_entries[nhsel].nh; |