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 1/1] baseband/acc: fix to possible negative shift
Date: Wed,  2 Nov 2022 11:30:50 -0700	[thread overview]
Message-ID: <20221102183050.12785-2-nicolas.chautru@intel.com> (raw)
In-Reply-To: <20221102183050.12785-1-nicolas.chautru@intel.com>

Potential occurrence of negative shift when using invalid
configuration on ACC200. Enforcing that depth > 0.

Coverity issue: 381636
Fixes: 40e3adbdd3 ("baseband/acc200: add queue configuration")

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

diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c
index 8ee9023451..7d7a6c6389 100644
--- a/drivers/baseband/acc/rte_acc200_pmd.c
+++ b/drivers/baseband/acc/rte_acc200_pmd.c
@@ -105,9 +105,9 @@ aqDepth(int qg_idx, struct rte_acc_conf *acc_conf)
 	qtopFromAcc(&q_top, acc_enum, acc_conf);
 
 	if (unlikely(q_top == NULL))
-		return 0;
+		return 1;
 
-	return q_top->aq_depth_log2;
+	return RTE_MAX(1, q_top->aq_depth_log2);
 }
 
 /* Return the AQ depth for a Queue Group Index. */
-- 
2.37.1


  reply	other threads:[~2022-11-02 18:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 18:30 [PATCH v1 0/1] baseband/acc: coverity fix RC2 Nicolas Chautru
2022-11-02 18:30 ` Nicolas Chautru [this message]
2022-11-03 11:27   ` [EXT] [PATCH v1 1/1] baseband/acc: fix to possible negative shift 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=20221102183050.12785-2-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).