From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50D364624E for ; Mon, 17 Feb 2025 18:08:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 450BA400EF; Mon, 17 Feb 2025 18:08:38 +0100 (CET) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id DDF29402DD for ; Mon, 17 Feb 2025 18:08:36 +0100 (CET) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4396a4d5e3bso30717735e9.3 for ; Mon, 17 Feb 2025 09:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739812116; x=1740416916; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X7FIRLyHsXKoSc9/p7qxF4r0Kl+JDh1C0ePw8Dd2gQE=; b=cgxM6BNEWMVIVgm7LLRnbrbgGSnaSCJpOSCuOiRGx/udAslou6BeWVIHDTixuyUGWV 3UX2l0J/EURfsM1rTBbWv0ophO8qQNwGc+7fjvZUlP6HVRqLIrm/iLTSkUqWlWmObgOK ZZZr/cKHlz+mZ+lZGK+0qPgUMhBgqW8BOF/36iZFOXlKgwGnlVpZAFEZbZJsdXUywh43 uDMWt8uUeZZVNgXMa8ti1zjiqLjt2PaKBSMRxTwMmIgfbu7+5MQXY1GSw1PajqAjni9d bOI8nZdxbnCXQ8zwgf+sRONUQ7hRHvMJQ7BZJ4sFWQluqtSXJuss3Pr95ifRjyKvXIcL TJMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739812116; x=1740416916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X7FIRLyHsXKoSc9/p7qxF4r0Kl+JDh1C0ePw8Dd2gQE=; b=kkzj2XvVzWczY65/ub/DV7EGfZdr9CaCx9gVbD/EnMJTO8R5sNwx5M8tZQ9r1Aq4do pemHuvEhoOJtrPjBVcGPSYPuQP8TN3MRtHv5BllO18jx9wD49ZbTBW/I6qsljmcwv3Rv frIdOuIe8HpdVtqrPZAHNxYnd9SKAlvH6PKmaPJWv2qLvIqtoOEGziRX7oe255SkaRyP p1yqmLExFqpnM/vgH6aZPp6WRzDOdS21xggJOkGSIqTDb+/096ZdTg4xFFuPZnp62EDb Pa72MK4B7P7ixtQ9UF+l3Tuoh8qpc5+U1TWemhHfEiQT9cfJFD9pBHYl4KkjTq9k6NAZ h26Q== X-Gm-Message-State: AOJu0YyzlTRqUrkZ6x5JIY+uQpASEwdI66EbmkcH69wfSBRPwUlQhstz erBeZ+wrjX2AOp2lPBTchMHfrALVR/J3RLqTSsdNhbFMdGt7NaPNEfEljKCcNZSGNA== X-Gm-Gg: ASbGncvCRNVftPWDjmxa48Jq+GRsCBiuD3cmao2LWk81mFwudZzxHZrQcyg/aS2qXxV GDLZ1wLz2/4sXghAs6bodwtI0OapzhWIx2E3wkRI/fSEp8LgE6Ju715l7TKyepGsO0lxrOgfj12 uvnQi6hn06d6xD6gsNiPVB0pZ27YDB+8bOq69NTGFuOF9Us56T5UNblYDwVsv0Bgnb8KP75cc5W W74gI1nalWbBbWOE0UL4/lawW9i8yMiZqKBb+outaUb+waPu3ImySaM9J2SfHWJ0znmB2WrVD5v ClTOaY3o5j5JDoKl9j/muA== X-Google-Smtp-Source: AGHT+IFdGS4rYd/iQ7qOp6SEruB7Wasg+/htyV79mtgS4njC+NbmFxgAPClwHMkoA8w3AZuQAZ6IWw== X-Received: by 2002:a05:600c:1d95:b0:439:88bb:d02f with SMTP id 5b1f17b1804b1-43988bbd25amr32238905e9.5.1739812116257; Mon, 17 Feb 2025 09:08:36 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:f83c:95e7:29fd:a997]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4395afaf052sm153686285e9.13.2025.02.17.09.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 09:08:35 -0800 (PST) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: dpdk stable Subject: patch 'net/hinic: fix flow type bitmask overflow' has been queued to stable release 22.11.8 Date: Mon, 17 Feb 2025 17:04:41 +0000 Message-ID: <20250217170456.1068278-68-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250217170456.1068278-1-luca.boccassi@gmail.com> References: <20250217170456.1068278-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 22.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/19/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/687588d938c783fb9c5130e777af6267861bb184 Thanks. Luca Boccassi --- >From 687588d938c783fb9c5130e777af6267861bb184 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 5 Feb 2025 08:23:12 -0800 Subject: [PATCH] net/hinic: fix flow type bitmask overflow [ upstream commit a357d5b703253b5920aba808a24877386a22720e ] The type mask is 64 bit value, doing a shift of literal 1 (32 bit) will result in int type (32 bit) and cause truncation. Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter") Signed-off-by: Stephen Hemminger --- drivers/net/hinic/hinic_pmd_flow.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c index 358b372e07..1c4618159b 100644 --- a/drivers/net/hinic/hinic_pmd_flow.c +++ b/drivers/net/hinic/hinic_pmd_flow.c @@ -1979,8 +1979,8 @@ static int hinic_lookup_new_filter(struct hinic_5tuple_filter *filter, return -EINVAL; } - if (!(filter_info->type_mask & (1 << type_id))) { - filter_info->type_mask |= 1 << type_id; + if (!(filter_info->type_mask & (UINT64_C(1) << type_id))) { + filter_info->type_mask |= UINT64_C(1) << type_id; filter->index = type_id; filter_info->pkt_filters[type_id].enable = true; filter_info->pkt_filters[type_id].pkt_proto = @@ -2138,7 +2138,7 @@ static void hinic_remove_5tuple_filter(struct rte_eth_dev *dev, filter_info->pkt_type = 0; filter_info->qid = 0; filter_info->pkt_filters[filter->index].qid = 0; - filter_info->type_mask &= ~(1 << (filter->index)); + filter_info->type_mask &= ~(UINT64_C(1) << filter->index); TAILQ_REMOVE(&filter_info->fivetuple_list, filter, entries); rte_free(filter); @@ -2268,8 +2268,8 @@ hinic_ethertype_filter_insert(struct hinic_filter_info *filter_info, if (id < 0) return -EINVAL; - if (!(filter_info->type_mask & (1 << id))) { - filter_info->type_mask |= 1 << id; + if (!(filter_info->type_mask & (UINT64_C(1) << id))) { + filter_info->type_mask |= UINT64_C(1) << id; filter_info->pkt_filters[id].pkt_proto = ethertype_filter->pkt_proto; filter_info->pkt_filters[id].enable = ethertype_filter->enable; @@ -2289,7 +2289,7 @@ hinic_ethertype_filter_remove(struct hinic_filter_info *filter_info, return; filter_info->pkt_type = 0; - filter_info->type_mask &= ~(1 << idx); + filter_info->type_mask &= ~(UINT64_C(1) << idx); filter_info->pkt_filters[idx].pkt_proto = (uint16_t)0; filter_info->pkt_filters[idx].enable = FALSE; filter_info->pkt_filters[idx].qid = 0; @@ -2355,7 +2355,7 @@ hinic_add_del_ethertype_filter(struct rte_eth_dev *dev, if (i < 0) return -EINVAL; - if ((filter_info->type_mask & (1 << i))) { + if ((filter_info->type_mask & (UINT64_C(1) << i))) { filter_info->pkt_filters[i].enable = FALSE; (void)hinic_set_fdir_filter(nic_dev->hwdev, filter_info->pkt_type, -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-17 16:13:19.237221190 +0000 +++ 0068-net-hinic-fix-flow-type-bitmask-overflow.patch 2025-02-17 16:13:16.866441592 +0000 @@ -1 +1 @@ -From a357d5b703253b5920aba808a24877386a22720e Mon Sep 17 00:00:00 2001 +From 687588d938c783fb9c5130e777af6267861bb184 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a357d5b703253b5920aba808a24877386a22720e ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index 8fdd5a35be..6b1ca6ff88 100644 +index 358b372e07..1c4618159b 100644