DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nicolas Chautru <nicolas.chautru@intel.com>
To: dev@dpdk.org, gakhil@marvell.com, maxime.coquelin@redhat.com,
	hernan.vargas@intel.com
Cc: Nicolas Chautru <nicolas.chautru@intel.com>
Subject: [PATCH v1 2/6] baseband/acc: fix to possible overflow
Date: Tue,  1 Nov 2022 16:04:55 -0700	[thread overview]
Message-ID: <20221101230459.50891-3-nicolas.chautru@intel.com> (raw)
In-Reply-To: <20221101230459.50891-1-nicolas.chautru@intel.com>

Potential overflow issue when casting to 64bits,
notably relevant when extending number of queues.

Coverity issue: 381665
Fixes: 32e8b7ea35 ("baseband/acc100: refactor to segregate common code")
Fixes: 40e3adbdd3 ("baseband/acc200: add queue configuration")

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc/rte_acc100_pmd.c | 3 +--
 drivers/baseband/acc/rte_acc200_pmd.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index 23bc5d25bb..b6e500c6bc 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -888,8 +888,7 @@ acc100_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 
 	if (q != NULL) {
 		/* Mark the Queue as un-assigned */
-		d->q_assigned_bit_map[q->qgrp_id] &= (0xFFFFFFFFFFFFFFFF -
-				(uint64_t) (1 << q->aq_id));
+		d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (1 << (uint64_t) q->aq_id));
 		rte_free(q->companion_ring_addr);
 		rte_free(q->lb_in);
 		rte_free(q->lb_out);
diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c
index 0cbb9a946b..76a5986448 100644
--- a/drivers/baseband/acc/rte_acc200_pmd.c
+++ b/drivers/baseband/acc/rte_acc200_pmd.c
@@ -964,7 +964,7 @@ acc200_queue_release(struct rte_bbdev *dev, uint16_t q_id)
 
 	if (q != NULL) {
 		/* Mark the Queue as un-assigned. */
-		d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (uint64_t) (1 << q->aq_id));
+		d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (1 << (uint64_t) q->aq_id));
 		rte_free(q->companion_ring_addr);
 		rte_free(q->lb_in);
 		rte_free(q->lb_out);
-- 
2.37.1


  parent reply	other threads:[~2022-11-01 23:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 23:04 [PATCH v1 0/6] baseband/acc: fixes on top of RC2 Nicolas Chautru
2022-11-01 23:04 ` [PATCH v1 1/6] baseband/acc: fix LTE half iteration flag Nicolas Chautru
2022-11-02  6:32   ` Maxime Coquelin
2022-11-01 23:04 ` Nicolas Chautru [this message]
2022-11-02  6:51   ` [PATCH v1 2/6] baseband/acc: fix to possible overflow Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 3/6] baseband/acc: fix to acc200 access corner case Nicolas Chautru
2022-11-02  6:52   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 4/6] baseband/acc: fix PMON register values Nicolas Chautru
2022-11-02  7:01   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 5/6] baseband/acc: fix double MSI intr in TB mode Nicolas Chautru
2022-11-02  7:16   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 6/6] baseband/acc: fix redundant function definition Nicolas Chautru
2022-11-02  7:19   ` Maxime Coquelin
2022-11-02 17:16     ` Chautru, Nicolas
2022-11-03  8:26 ` [EXT] [PATCH v1 0/6] baseband/acc: fixes on top of RC2 Akhil Goyal

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=20221101230459.50891-3-nicolas.chautru@intel.com \
    --to=nicolas.chautru@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=hernan.vargas@intel.com \
    --cc=maxime.coquelin@redhat.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).