Skip to content

Commit 3c5d0dc

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: mcq: 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. Cc: Bao D. Nguyen <[email protected]> Cc: Stanley Chu <[email protected]> Cc: Can Guo <[email protected]> Fixes: 8d72903 ("scsi: ufs: mcq: Add supporting functions for MCQ abort") Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0d8b637 commit 3c5d0dc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,7 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
601601
addr = le64_to_cpu(cmd_desc_base_addr) & CQE_UCD_BA;
602602

603603
while (sq_head_slot != hwq->sq_tail_slot) {
604-
utrd = hwq->sqe_base_addr +
605-
sq_head_slot * sizeof(struct utp_transfer_req_desc);
604+
utrd = hwq->sqe_base_addr + sq_head_slot;
606605
match = le64_to_cpu(utrd->command_desc_base_addr) & CQE_UCD_BA;
607606
if (addr == match) {
608607
ufshcd_mcq_nullify_sqe(utrd);

0 commit comments

Comments
 (0)