diff mbox series

scsi/qlogicpti: Fix dma_map_sg check

Message ID 20220826101435.79170-1-jinpu.wang@ionos.com
State New
Headers show
Series scsi/qlogicpti: Fix dma_map_sg check | expand

Commit Message

Jinpu Wang Aug. 26, 2022, 10:14 a.m. UTC
Add the missing error check for dma_map_sg.

Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/scsi/qlogicpti.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen Sept. 7, 2022, 2:15 a.m. UTC | #1
Jack,

> Add the missing error check for dma_map_sg.

Applied to 6.1/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 57f2f4135a06..8c961ff03fcd 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -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;