From: Hemant Agrawal <hemant.agrawal@oss.nxp.com>
To: Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org
Cc: nipun.gupta@nxp.com, stable@dpdk.org,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@nxp.com>,
Nipun Gupta <nipun.gupta@amd.com>
Subject: Re: [PATCH 16/16] net/dpaa2: fix bitmask truncation
Date: Mon, 18 Nov 2024 12:34:45 +0530 [thread overview]
Message-ID: <25ed9d3d-7a68-e294-10b0-94c72745d768@oss.nxp.com> (raw)
In-Reply-To: <20241115060738.313190-17-stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
On 15-11-2024 11:35, Stephen Hemminger wrote:
> The dqrr_held mask is 64 bit but updates were getting truncated
> because 1 is of type int (32 bit) and the result shift of int is of
> type int (32 bit); therefore any value >= 32 would get truncated.
>
> Link: https://pvs-studio.com/en/blog/posts/cpp/1183/
>
> Fixes: 2d3788631862 ("net/dpaa2: support atomic queues")
> Cc: nipun.gupta@nxp.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/dpaa2/dpaa2_rxtx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index e3b6c7e460..e253bccecd 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -933,7 +933,7 @@ dpaa2_dev_process_atomic_event(struct qbman_swp *swp __rte_unused,
> dqrr_index = qbman_get_dqrr_idx(dq);
> *dpaa2_seqn(ev->mbuf) = dqrr_index + 1;
> DPAA2_PER_LCORE_DQRR_SIZE++;
> - DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index;
> + DPAA2_PER_LCORE_DQRR_HELD |= UINT64_C(1) << dqrr_index;
> DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = ev->mbuf;
> }
>
> @@ -1317,7 +1317,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
> flags[loop] = QBMAN_ENQUEUE_FLAG_DCA |
> dqrr_index;
> DPAA2_PER_LCORE_DQRR_SIZE--;
> - DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dqrr_index);
> + DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dqrr_index);
> *dpaa2_seqn(*bufs) = DPAA2_INVALID_MBUF_SEQN;
> }
>
> @@ -1575,7 +1575,7 @@ dpaa2_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q,
> dq_idx = *dpaa2_seqn(m) - 1;
> qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0);
> DPAA2_PER_LCORE_DQRR_SIZE--;
> - DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dq_idx);
> + DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx);
> }
> *dpaa2_seqn(m) = DPAA2_INVALID_MBUF_SEQN;
> }
next prev parent reply other threads:[~2024-11-18 7:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241115060738.313190-1-stephen@networkplumber.org>
2024-11-15 6:05 ` [PATCH 06/16] eal: fix out of bounds access in devargs Stephen Hemminger
2024-11-15 6:05 ` [PATCH 07/16] net/qede: fix missing debug string Stephen Hemminger
2024-11-15 6:05 ` [PATCH 09/16] examples/ptpclient: fix self memcmp Stephen Hemminger
2024-11-15 6:05 ` [PATCH 11/16] net/hinic: fix flow type bitmask overflow Stephen Hemminger
2024-11-15 6:05 ` [PATCH 12/16] crypto/dpaa2_sec: fix bitmask truncation Stephen Hemminger
2024-11-18 7:03 ` Hemant Agrawal
2024-11-15 6:05 ` [PATCH 13/16] crypto/dpaa_sec: " Stephen Hemminger
2024-11-18 7:03 ` Hemant Agrawal
2024-11-15 6:05 ` [PATCH 14/16] event/dpaa: " Stephen Hemminger
2024-11-18 7:04 ` Hemant Agrawal
2024-11-15 6:05 ` [PATCH 15/16] net/dpaa: " Stephen Hemminger
2024-11-18 7:04 ` Hemant Agrawal
2024-11-15 6:05 ` [PATCH 16/16] net/dpaa2: " Stephen Hemminger
2024-11-18 7:04 ` Hemant Agrawal [this message]
[not found] ` <20241118182153.87042-1-stephen@networkplumber.org>
2024-11-18 18:20 ` [PATCH v2 06/19] eal: fix out of bounds access in devargs Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 07/19] net/qede: fix missing debug string Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 09/19] examples/ptpclient: fix self memcmp Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 11/19] net/hinic: fix flow type bitmask overflow Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 12/19] crypto/dpaa2_sec: fix bitmask truncation Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 13/19] crypto/dpaa_sec: " Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 14/19] event/dpaa: " Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 15/19] net/dpaa: " Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 16/19] net/dpaa2: " Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 17/19] net/qede: don't use same loop variable twice Stephen Hemminger
2024-11-18 18:20 ` [PATCH v2 18/19] examples/l3fwd: fix operator precedence bugs Stephen Hemminger
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=25ed9d3d-7a68-e294-10b0-94c72745d768@oss.nxp.com \
--to=hemant.agrawal@oss.nxp.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=nipun.gupta@amd.com \
--cc=nipun.gupta@nxp.com \
--cc=sachin.saxena@nxp.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
/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).