Skip to content

Commit aa7674b

Browse files
Justin Teemartinkpetersen
authored andcommitted
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>
1 parent 2ae917d commit aa7674b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,14 +2728,14 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
27282728
sgde = scsi_sglist(cmd);
27292729
blksize = scsi_prot_interval(cmd);
27302730
data_src = (uint8_t *)sg_virt(sgde);
2731-
data_len = sgde->length;
2731+
data_len = sg_dma_len(sgde);
27322732
if ((data_len & (blksize - 1)) == 0)
27332733
chk_guard = 1;
27342734

27352735
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
27362736
start_ref_tag = scsi_prot_ref_tag(cmd);
27372737
start_app_tag = src->app_tag;
2738-
len = sgpe->length;
2738+
len = sg_dma_len(sgpe);
27392739
while (src && protsegcnt) {
27402740
while (len) {
27412741

@@ -2800,7 +2800,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
28002800
goto out;
28012801

28022802
data_src = (uint8_t *)sg_virt(sgde);
2803-
data_len = sgde->length;
2803+
data_len = sg_dma_len(sgde);
28042804
if ((data_len & (blksize - 1)) == 0)
28052805
chk_guard = 1;
28062806
}
@@ -2810,7 +2810,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
28102810
sgpe = sg_next(sgpe);
28112811
if (sgpe) {
28122812
src = (struct scsi_dif_tuple *)sg_virt(sgpe);
2813-
len = sgpe->length;
2813+
len = sg_dma_len(sgpe);
28142814
} else {
28152815
src = NULL;
28162816
}

0 commit comments

Comments
 (0)