DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Srikanth Yalavarthi <syalavarthi@marvell.com>,
	Prince Takkar <ptakkar@marvell.com>
Cc: <dev@dpdk.org>, <sshankarnara@marvell.com>, <aprabhu@marvell.com>,
	<pshukla@marvell.com>
Subject: [PATCH v3 1/8] ml/cnxk: fix evaluation order violation issues
Date: Thu, 16 Mar 2023 14:28:57 -0700	[thread overview]
Message-ID: <20230316212904.9318-2-syalavarthi@marvell.com> (raw)
In-Reply-To: <20230316212904.9318-1-syalavarthi@marvell.com>

Fix evaluation order violation issues reported by coverity
tool. ocm_mask variable is being written twice with the
same value.

Coverity issue: 383659
Fixes: b7d0650ebce0 ("ml/cnxk: reserve and free OCM pages")

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 drivers/ml/cnxk/cn10k_ml_ocm.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/ml/cnxk/cn10k_ml_ocm.c b/drivers/ml/cnxk/cn10k_ml_ocm.c
index d8d2c71a3c..1ea45b5b60 100644
--- a/drivers/ml/cnxk/cn10k_ml_ocm.c
+++ b/drivers/ml/cnxk/cn10k_ml_ocm.c
@@ -423,10 +423,8 @@ cn10k_ml_ocm_free_pages(struct rte_ml_dev *dev, uint16_t model_id)
 	wb_page_end = wb_page_start + model->model_mem_map.wb_pages - 1;
 	for (tile_id = model->addr.tile_start; tile_id <= model->addr.tile_end; tile_id++) {
 		for (page_id = wb_page_start; page_id <= wb_page_end; page_id++) {
-			ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE] =
-				CLEAR_BIT(ocm->tile_ocm_info[tile_id]
-						  .ocm_mask[page_id / OCM_MAP_WORD_SIZE],
-					  page_id % OCM_MAP_WORD_SIZE);
+			CLEAR_BIT(ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE],
+				  page_id % OCM_MAP_WORD_SIZE);
 		}
 
 		/* Update last_wb_page size */
@@ -452,10 +450,9 @@ cn10k_ml_ocm_free_pages(struct rte_ml_dev *dev, uint16_t model_id)
 			prev_start = ocm->num_pages - ocm->tile_ocm_info[tile_id].scratch_pages;
 			curr_start = ocm->num_pages - scratch_resize_pages;
 			for (page_id = prev_start; page_id < curr_start; page_id++) {
-				ocm->tile_ocm_info[tile_id].ocm_mask[page_id / OCM_MAP_WORD_SIZE] =
-					CLEAR_BIT(ocm->tile_ocm_info[tile_id]
-							  .ocm_mask[page_id / OCM_MAP_WORD_SIZE],
-						  page_id % OCM_MAP_WORD_SIZE);
+				CLEAR_BIT(ocm->tile_ocm_info[tile_id]
+						  .ocm_mask[page_id / OCM_MAP_WORD_SIZE],
+					  page_id % OCM_MAP_WORD_SIZE);
 			}
 			ocm->tile_ocm_info[tile_id].scratch_pages = scratch_resize_pages;
 		}
-- 
2.17.1


  reply	other threads:[~2023-03-16 21:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 13:54 [PATCH 1/1] ml/cnxk: fix multiple coverity issues Srikanth Yalavarthi
2023-03-16  9:33 ` [PATCH v2 " Srikanth Yalavarthi
2023-03-16 17:00   ` Thomas Monjalon
2023-03-16 17:02     ` [EXT] " Srikanth Yalavarthi
2023-03-16 17:07       ` Thomas Monjalon
2023-03-16 21:28 ` [PATCH v3 0/8] Fixes to ml/cnxk driver Srikanth Yalavarthi
2023-03-16 21:28   ` Srikanth Yalavarthi [this message]
2023-03-16 21:28   ` [PATCH v3 2/8] ml/cnxk: fix potential division by zero Srikanth Yalavarthi
2023-03-16 21:28   ` [PATCH v3 3/8] ml/cnxk: add pointer check after memory allocation Srikanth Yalavarthi
2023-03-16 21:29   ` [PATCH v3 4/8] ml/cnxk: remove logically dead code Srikanth Yalavarthi
2023-03-16 21:29   ` [PATCH v3 5/8] ml/cnxk: fix potential memory leak in xstats Srikanth Yalavarthi
2023-03-16 21:29   ` [PATCH v3 6/8] ml/cnxk: check for null pointer before dereference Srikanth Yalavarthi
2023-03-16 21:29   ` [PATCH v3 7/8] ml/cnxk: avoid variable name reuse in a function Srikanth Yalavarthi
2023-03-16 21:29   ` [PATCH v3 8/8] ml/cnxk: reduce levels of nested variables access Srikanth Yalavarthi
2023-03-19 19:01   ` [PATCH v3 0/8] Fixes to ml/cnxk driver 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=20230316212904.9318-2-syalavarthi@marvell.com \
    --to=syalavarthi@marvell.com \
    --cc=aprabhu@marvell.com \
    --cc=dev@dpdk.org \
    --cc=pshukla@marvell.com \
    --cc=ptakkar@marvell.com \
    --cc=sshankarnara@marvell.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).