* [PATCH] scsi/ufs: Fix ufshcd_mcq_sqe_search()
@ 2024-04-10 0:07 Bart Van Assche
2024-04-25 1:01 ` Martin K. Petersen
2024-05-07 1:59 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Bart Van Assche @ 2024-04-10 0:07 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Bao D . Nguyen, Stanley Chu,
Can Guo, James E.J. Bottomley, Matthias Brugger,
AngeloGioacchino Del Regno, Stanley Jhu, Po-Wen Kao, ChanWoo Lee,
Yang Li
Fix the calculation of the utrd pointer. This patch addresses the following
Coverity complaint:
CID 1538170: (#1 of 1): Extra sizeof expression (SIZEOF_MISMATCH)
suspicious_pointer_arithmetic: Adding sq_head_slot * 32UL /* sizeof (struct
utp_transfer_req_desc) */ to pointer hwq->sqe_base_addr of type struct
utp_transfer_req_desc * is suspicious because adding an integral value to
this pointer automatically scales that value by the size, 32 bytes, of the
pointed-to type, struct utp_transfer_req_desc. Most likely, the
multiplication by sizeof (struct utp_transfer_req_desc) in this expression
is extraneous and should be eliminated.
Cc: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Can Guo <quic_cang@quicinc.com>
Fixes: 8d7290348992 ("scsi: ufs: mcq: Add supporting functions for MCQ abort")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ufs/core/ufs-mcq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 768bf87cd80d..005d63ab1f44 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -601,8 +601,7 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
addr = le64_to_cpu(cmd_desc_base_addr) & CQE_UCD_BA;
while (sq_head_slot != hwq->sq_tail_slot) {
- utrd = hwq->sqe_base_addr +
- sq_head_slot * sizeof(struct utp_transfer_req_desc);
+ utrd = hwq->sqe_base_addr + sq_head_slot;
match = le64_to_cpu(utrd->command_desc_base_addr) & CQE_UCD_BA;
if (addr == match) {
ufshcd_mcq_nullify_sqe(utrd);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi/ufs: Fix ufshcd_mcq_sqe_search()
2024-04-10 0:07 [PATCH] scsi/ufs: Fix ufshcd_mcq_sqe_search() Bart Van Assche
@ 2024-04-25 1:01 ` Martin K. Petersen
2024-05-07 1:59 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2024-04-25 1:01 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Bao D . Nguyen, Stanley Chu,
Can Guo, James E.J. Bottomley, Matthias Brugger,
AngeloGioacchino Del Regno, Stanley Jhu, Po-Wen Kao, ChanWoo Lee,
Yang Li
Bart,
> Fix the calculation of the utrd pointer. This patch addresses the following
> Coverity complaint:
Applied to 6.10/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi/ufs: Fix ufshcd_mcq_sqe_search()
2024-04-10 0:07 [PATCH] scsi/ufs: Fix ufshcd_mcq_sqe_search() Bart Van Assche
2024-04-25 1:01 ` Martin K. Petersen
@ 2024-05-07 1:59 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2024-05-07 1:59 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Bao D . Nguyen, Stanley Chu,
Can Guo, James E.J. Bottomley, Matthias Brugger,
AngeloGioacchino Del Regno, Stanley Jhu, Po-Wen Kao, ChanWoo Lee,
Yang Li
On Tue, 09 Apr 2024 17:07:45 -0700, Bart Van Assche wrote:
> Fix the calculation of the utrd pointer. This patch addresses the following
> Coverity complaint:
>
> CID 1538170: (#1 of 1): Extra sizeof expression (SIZEOF_MISMATCH)
> suspicious_pointer_arithmetic: Adding sq_head_slot * 32UL /* sizeof (struct
> utp_transfer_req_desc) */ to pointer hwq->sqe_base_addr of type struct
> utp_transfer_req_desc * is suspicious because adding an integral value to
> this pointer automatically scales that value by the size, 32 bytes, of the
> pointed-to type, struct utp_transfer_req_desc. Most likely, the
> multiplication by sizeof (struct utp_transfer_req_desc) in this expression
> is extraneous and should be eliminated.
>
> [...]
Applied to 6.10/scsi-queue, thanks!
[1/1] scsi/ufs: Fix ufshcd_mcq_sqe_search()
https://git.kernel.org/mkp/scsi/c/3c5d0dce8ce0
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-07 2:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 0:07 [PATCH] scsi/ufs: Fix ufshcd_mcq_sqe_search() Bart Van Assche
2024-04-25 1:01 ` Martin K. Petersen
2024-05-07 1:59 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.