ethdev: keep count of representor ranges in API
authorViacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Mon, 5 Jul 2021 10:02:52 +0000 (13:02 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 10 Jul 2021 09:29:11 +0000 (11:29 +0200)
commit10eaf41d708d5cbec9f79d74cf4711556278f7e7
tree328ba5b9a3a65c12a023a1f645bc8d7a5813316a
parent7bc7bc3516ad7d4c082cb24daedd02117cc162ef
ethdev: keep count of representor ranges in API

In its current state, the API can overflow the user-passed buffer if a new
representor range appears between function calls.

In order to solve this problem, augment the representor info structure with
the numbers of allocated and initialized ranges. This way the users of this
structure can be sure they will not overrun the buffer.

Fixes: 85e1588ca72f ("ethdev: add API to get representor info")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
drivers/net/mlx5/mlx5_ethdev.c
lib/ethdev/rte_ethdev.c
lib/ethdev/rte_ethdev.h