mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: fnic: fix missing dma mapping error in `fnic_send_frame()`
@ 2025-06-18  6:57 Thomas Fourier
  2025-06-18 15:58 ` Karan Tilak Kumar (kartilak)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Fourier @ 2025-06-18  6:57 UTC (permalink / raw)
  Cc: Thomas Fourier, Satish Kharat, Sesidhar Baddela,
	Karan Tilak Kumar, James E.J. Bottomley, Martin K. Petersen,
	Arulprabhu Ponnusamy, Arun Easi, Gian Carlo Boffa, linux-scsi,
	linux-kernel

`dma_map_XXX()` can fail and should be tested for errors with
`dma_mapping_error().`

Fixes: a63e78eb2b0f ("scsi: fnic: Add support for fabric based solicited requests and responses")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/scsi/fnic/fnic_fcs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index 1e8cd64f9a5c..103ab6f1f7cd 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -636,6 +636,8 @@ static int fnic_send_frame(struct fnic *fnic, void *frame, int frame_len)
 	unsigned long flags;
 
 	pa = dma_map_single(&fnic->pdev->dev, frame, frame_len, DMA_TO_DEVICE);
+	if (dma_mapping_error(&fnic->pdev->dev, pa))
+		return -ENOMEM;
 
 	if ((fnic_fc_trace_set_data(fnic->fnic_num,
 				FNIC_FC_SEND | 0x80, (char *) frame,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-20  3:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-18  6:57 [PATCH] scsi: fnic: fix missing dma mapping error in `fnic_send_frame()` Thomas Fourier
2025-06-18 15:58 ` Karan Tilak Kumar (kartilak)
2025-06-18 17:24 ` John Meneghini
2025-06-20  3:19 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®