Skip to contentSkip to conversation

scsi/qlogicpti: Fix dma_map_sg check

PATCH Applied Jack Wang 2 participants 2 messages Aug 26, 2022 – Sep 7, 2022 SCSI

lore
Share & tools
lore

Jack Wang

author
#0 lore raw

PATCH 1/1 scsi/qlogicpti: Fix dma_map_sg check

Add the missing error check for dma_map_sg.

Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
---
 drivers/scsi/qlogicpti.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qlogicpti.c +2 -1
index 57f2f4135a06..8c961ff03fcd 100644
@@ -909,7 +909,8 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
 		sg_count = dma_map_sg(&qpti->op->dev, sg,
 				      scsi_sg_count(Cmnd),
 				      Cmnd->sc_data_direction);
-
+		if (!sg_count)
+			return -1;
 		ds = cmd->dataseg;
 		cmd->segment_cnt = sg_count;
 
Signature · 1 line
2.34.1
#1 lore raw

Jack,

Quoted 1 line

Add the missing error check for dma_map_sg.

Applied to 6.1/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering