mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 20:35:23 +02:00
UPSTREAM: 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 <quic_nguyenb@quicinc.com> Cc: Stanley Chu <stanley.chu@mediatek.com> Cc: Can Guo <quic_cang@quicinc.com> Fixes:8d72903489
("scsi: ufs: mcq: Add supporting functions for MCQ abort") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20240410000751.1047758-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Bug: 345389865 (cherry picked from commit3c5d0dce8c
) Change-Id: I05e2ebdff929e7646cb86eb45bba3bc77b942ed6 Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
This commit is contained in:
parent
96498cee93
commit
e5ee6d1db4
|
@ -597,8 +597,7 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
|
||||||
addr = le64_to_cpu(cmd_desc_base_addr) & CQE_UCD_BA;
|
addr = le64_to_cpu(cmd_desc_base_addr) & CQE_UCD_BA;
|
||||||
|
|
||||||
while (sq_head_slot != hwq->sq_tail_slot) {
|
while (sq_head_slot != hwq->sq_tail_slot) {
|
||||||
utrd = hwq->sqe_base_addr +
|
utrd = hwq->sqe_base_addr + sq_head_slot;
|
||||||
sq_head_slot * sizeof(struct utp_transfer_req_desc);
|
|
||||||
match = le64_to_cpu(utrd->command_desc_base_addr) & CQE_UCD_BA;
|
match = le64_to_cpu(utrd->command_desc_base_addr) & CQE_UCD_BA;
|
||||||
if (addr == match) {
|
if (addr == match) {
|
||||||
ufshcd_mcq_nullify_sqe(utrd);
|
ufshcd_mcq_nullify_sqe(utrd);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user