scsi: lpfc: Use sg_dma_len() API to get struct scatterlist's length

The sg_dma_len() API should be used to retrieve a scatterlist's length
instead of directly accessing scatterlist->length.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20240131185112.149731-4-justintee8345@gmail.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Justin Tee 2024-01-31 10:50:58 -08:00 committed by Martin K. Petersen
parent 2ae917d4bc
commit aa7674bd8d

View File

@ -2728,14 +2728,14 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
sgde = scsi_sglist(cmd);
blksize = scsi_prot_interval(cmd);
data_src = (uint8_t *)sg_virt(sgde);
data_len = sgde->length;
data_len = sg_dma_len(sgde);
if ((data_len & (blksize - 1)) == 0)
chk_guard = 1;
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
start_ref_tag = scsi_prot_ref_tag(cmd);
start_app_tag = src->app_tag;
len = sgpe->length;
len = sg_dma_len(sgpe);
while (src && protsegcnt) {
while (len) {
@ -2800,7 +2800,7 @@ skipit:
goto out;
data_src = (uint8_t *)sg_virt(sgde);
data_len = sgde->length;
data_len = sg_dma_len(sgde);
if ((data_len & (blksize - 1)) == 0)
chk_guard = 1;
}
@ -2810,7 +2810,7 @@ skipit:
sgpe = sg_next(sgpe);
if (sgpe) {
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
len = sgpe->length;
len = sg_dma_len(sgpe);
} else {
src = NULL;
}