From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08BC5A04E6 for ; Wed, 18 Nov 2020 18:00:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E700EC938; Wed, 18 Nov 2020 18:00:38 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 8B43AC8B2 for ; Wed, 18 Nov 2020 18:00:25 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from michaelba@nvidia.com) with SMTP; 18 Nov 2020 19:00:19 +0200 Received: from nvidia.com (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0AIH0IwX005874; Wed, 18 Nov 2020 19:00:18 +0200 From: Michael Baum To: dev@dpdk.org Cc: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , stable@dpdk.org Date: Wed, 18 Nov 2020 17:00:06 +0000 Message-Id: <1605718811-18652-2-git-send-email-michaelba@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> References: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> Subject: [dpdk-stable] [PATCH 2/7] regex/mlx5: fix iterator type in RXP engines management X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 Acked-by: Ori Kam --- drivers/regex/mlx5/mlx5_rxp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 1.8.3.1