scsi/ufs: Fix ufshcd_mcq_sqe_search()
Subsystems (2)
Bart Van Assche
reviewerPATCH 1/1 scsi/ufs: Fix ufshcd_mcq_sqe_search()
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.
--- drivers/ufs/core/ufs-mcq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ufs/core/ufs-mcq.c +1 -2
@@ -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);
Martin K. Petersen
AppliedBart,
Quoted 2 lines
Fix the calculation of the utrd pointer. This patch addresses the following Coverity complaint:
Applied to 6.10/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 12 lines · Bart Van Assche
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: Addingsq_head_slot* 32UL /* sizeof (structutp_transfer_req_desc) */ to pointerhwq->sqe_base_addrof type structutp_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, structutp_transfer_req_desc. Most likely, the multiplication by sizeof (structutp_transfer_req_desc) in this expression is extraneous and should be eliminated.
Quoted 1 line
[...]
Applied to 6.10/scsi-queue, thanks!
[1/1] scsi/ufs: Fix ufshcd_mcq_sqe_search()
https://git.kernel.org/mkp/scsi/c/3c5d0dce8ce0
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering