From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
Raslan Darawsheh <rasland@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 1/4] regex/mlx5: fix size of setup constants
Date: Thu, 1 Jul 2021 09:39:13 +0300 [thread overview]
Message-ID: <20210701063916.2016763-1-michaelba@nvidia.com> (raw)
In-Reply-To: <20210601071122.1612432-1-michaelba@nvidia.com>
The constant representing the size of the metadata is defined as a
unsigned int variable with 32-bit.
Similarly the constant representing the maximal output is also defined
as a unsigned int variable with 32-bit.
There is potentially overflowing expression when those constants are
evaluated using 32-bit arithmetic, and then used in a context that
expects an expression of type size_t that might be 64 bit.
Change the size of the above constants to size_t.
Fixes: 30d604bb1504 ("regex/mlx5: fix type of setup constants")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
v2: use size_t and uintptr_t instead of uint64_t.
drivers/regex/mlx5/mlx5_regex_fastpath.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c
index b57e7d7794..910bc845f3 100644
--- a/drivers/regex/mlx5/mlx5_regex_fastpath.c
+++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c
@@ -25,8 +25,8 @@
#include "mlx5_regex.h"
#define MLX5_REGEX_MAX_WQE_INDEX 0xffff
-#define MLX5_REGEX_METADATA_SIZE UINT32_C(64)
-#define MLX5_REGEX_MAX_OUTPUT RTE_BIT32(11)
+#define MLX5_REGEX_METADATA_SIZE ((size_t)64)
+#define MLX5_REGEX_MAX_OUTPUT (((size_t)1) << 11)
#define MLX5_REGEX_WQE_CTRL_OFFSET 12
#define MLX5_REGEX_WQE_METADATA_OFFSET 16
#define MLX5_REGEX_WQE_GATHER_OFFSET 32
--
2.25.1
next prev parent reply other threads:[~2021-07-01 6:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 7:11 [dpdk-dev] [PATCH " Michael Baum
2021-06-01 7:11 ` [dpdk-dev] [PATCH 2/4] compress/mlx5: fix constant size in QP creation Michael Baum
2021-06-07 7:28 ` Matan Azrad
2021-06-23 6:47 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2021-06-28 14:21 ` Michael Baum
2021-06-01 7:11 ` [dpdk-dev] [PATCH 3/4] vdpa/mlx5: fix constant type " Michael Baum
2021-06-07 7:29 ` Matan Azrad
2021-06-01 7:11 ` [dpdk-dev] [PATCH 4/4] net/mlx5: fix constant type in MP allocation Michael Baum
2021-06-07 7:29 ` Matan Azrad
2021-06-07 7:28 ` [dpdk-dev] [PATCH 1/4] regex/mlx5: fix size of setup constants Matan Azrad
2021-07-01 6:39 ` Michael Baum [this message]
2021-07-01 6:39 ` [dpdk-dev] [PATCH v2 2/4] compress/mlx5: fix constant size in QP creation Michael Baum
2021-07-01 6:39 ` [dpdk-dev] [PATCH v2 3/4] vdpa/mlx5: fix constant type " Michael Baum
2021-07-01 6:39 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: fix constant type in MP allocation Michael Baum
2021-07-22 12:50 ` [dpdk-dev] [PATCH v2 1/4] regex/mlx5: fix size of setup constants Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210701063916.2016763-1-michaelba@nvidia.com \
--to=michaelba@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=rasland@nvidia.com \
--cc=stable@dpdk.org \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).