From: Rand Deeb <rand.sec96@gmail.com>
To: "James E . J . Bottomley" <jejb@linux.ibm.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: deeb.rand@confident.ru, lvc-project@linuxtesting.org,
voskresenski.stanislav@confident.ru,
Rand Deeb <rand.sec96@gmail.com>
Subject: [PATCH] scsi: fix calculation of phy_addr in mvumi_delete_internal_cmd
Date: Sat, 16 Dec 2023 21:50:06 +0300 [thread overview]
Message-ID: <20231216185006.19200-1-rand.sec96@gmail.com> (raw)
The calculation of phy_addr in mvumi_delete_internal_cmd contained an issue
where the expression '(dma_addr_t) ((m_sg->baseaddr_h << 16) << 16)' was used.
This expression was found to be incorrect and useless because it always evaluates
to zero, regardless of the actual value of m_sg->baseaddr_h since it's u32.
This commit resolves the issue by placing the casting inside the brackets, making it
more meaningful: (((dma_addr_t) m_sg->baseaddr_h << 16) << 16)
The corrected expression ensures that phy_addr is calculated correctly and
addresses the previous issue, preventing the unnecessary use of a zero value.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
---
drivers/scsi/mvumi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 0354898d7cac..675ea5dcaa21 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -296,7 +296,7 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba,
sgd_getsz(mhba, m_sg, size);
phy_addr = (dma_addr_t) m_sg->baseaddr_l |
- (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16);
+ (((dma_addr_t) m_sg->baseaddr_h << 16) << 16);
dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf,
phy_addr);
--
2.34.1
reply other threads:[~2023-12-16 18:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20231216185006.19200-1-rand.sec96@gmail.com \
--to=rand.sec96@gmail.com \
--cc=deeb.rand@confident.ru \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=voskresenski.stanislav@confident.ru \
/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