regex/mlx5: fix RXP engines iterator size
authorMichael Baum <michaelba@nvidia.com>
Wed, 18 Nov 2020 17:00:06 +0000 (17:00 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 22 Nov 2020 12:19:06 +0000 (13:19 +0100)
commita07079b1a69b031d7dc82092af89cae0c65a0ee6
treec3f6e729728f2e17c0be8a52d1fc24a04f1e6f0a
parent3423d02b6d3ffcf78803b7c3404cdc6abd072ef6
regex/mlx5: fix RXP engines iterator size

The mlx5_regex_rules_db_import function goes over all engines in the
loop and program rxp rules.

The iterator of the loop is called id and the variable representing the
number of engines is called priv->nb_engines.
The id variable is of uint8_t type while the priv->nb_engines variable
is of uint32_t type. The size of the priv->nb_engines variable is much
larger than the number of iterations allowed by the id type.
Theoretically there may be a situation where the value of the
priv->nb_engines will be greater than can be represented by 8 bits and
the loop will never end.

Change the type of id to uint32_t.

Fixes: b34d816363b5 ("regex/mlx5: support rules import")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
drivers/regex/mlx5/mlx5_rxp.c