diff mbox series

[2/7] regex/mlx5: fix iterator type in RXP engines management

Message ID 1605718811-18652-2-git-send-email-michaelba@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [1/7] regex/mlx5: fix jump to the wrong label | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Michael Baum Nov. 18, 2020, 5 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c
index 7936a52..e54d2b8 100644
--- a/drivers/regex/mlx5/mlx5_rxp.c
+++ b/drivers/regex/mlx5/mlx5_rxp.c
@@ -921,7 +921,7 @@ 
 	struct mlx5_regex_priv *priv = dev->data->dev_private;
 	struct mlx5_rxp_ctl_rules_pgm *rules = NULL;
-	uint8_t id;
+	uint32_t id;
 	int ret;
 	if (priv->prog_mode == MLX5_RXP_MODE_NOT_DEFINED) {