linux-kernel.vger.kernel.org archive mirror
 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 related	[flat|nested] 4+ messages in thread

* RE: [PATCH] scsi: fnic: fix missing dma mapping error in `fnic_send_frame()`
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Karan Tilak Kumar (kartilak) @ 2025-06-18 15:58 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: Satish Kharat (satishkh), Sesidhar Baddela (sebaddel),
	James E.J. Bottomley, Martin K. Petersen,
	Arulprabhu Ponnusamy (arulponn), Arun Easi (aeasi),
	Gian Carlo Boffa (gcboffa), linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Tuesday, June 17, 2025 11:57 PM, Thomas Fourier <fourier.thomas@gmail.com> wrote:
>
> `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
>
>

Looks good to me.

Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>

Regards,
Karan

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

* Re: [PATCH] scsi: fnic: fix missing dma mapping error in `fnic_send_frame()`
  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
  2 siblings, 0 replies; 4+ messages in thread
From: John Meneghini @ 2025-06-18 17:24 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: 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

Reviewed-by: John Menghini <jmeneghi@redhat.com>

Martin, can we get this merged into 6.16/scsi-fixes as well?

/John

On 6/18/25 2:57 AM, Thomas Fourier wrote:
> `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,


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

* Re: [PATCH] scsi: fnic: fix missing dma mapping error in `fnic_send_frame()`
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-06-20  3:19 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: Martin K . Petersen, Satish Kharat, Sesidhar Baddela,
	Karan Tilak Kumar, James E.J. Bottomley, Arulprabhu Ponnusamy,
	Arun Easi, Gian Carlo Boffa, linux-scsi, linux-kernel

On Wed, 18 Jun 2025 08:57:04 +0200, Thomas Fourier wrote:

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

Applied to 6.16/scsi-fixes, thanks!

[1/1] scsi: fnic: fix missing dma mapping error in `fnic_send_frame()`
      https://git.kernel.org/mkp/scsi/c/85d6fbc47c30

-- 
Martin K. Petersen	Oracle Linux Engineering

^ 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;
as well as URLs for NNTP newsgroup(s).