linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand/fsmc:  Add missing check after DMA map
@ 2025-07-01 11:55 Thomas Fourier
  2025-07-01 12:52 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2025-07-01 11:55 UTC (permalink / raw)
  Cc: Thomas Fourier, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Uwe Kleine-König, David Woodhouse,
	Viresh Kumar, Artem Bityutskiy, Vipin Kumar, linux-mtd,
	linux-kernel

The DMA map functions can fail and should be tested for errors.

Fixes: 4774fb0a48aa ("mtd: nand/fsmc: Add DMA support")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/mtd/nand/raw/fsmc_nand.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index d579d5dd60d6..df61db8ce466 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -503,6 +503,8 @@ static int dma_xfer(struct fsmc_nand_data *host, void *buffer, int len,
 
 	dma_dev = chan->device;
 	dma_addr = dma_map_single(dma_dev->dev, buffer, len, direction);
+	if (dma_mapping_error(dma_dev->dev, dma_addr))
+		return -EINVAL;
 
 	if (direction == DMA_TO_DEVICE) {
 		dma_src = dma_addr;
-- 
2.43.0


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

* Re: [PATCH] mtd: nand/fsmc:  Add missing check after DMA map
  2025-07-01 11:55 [PATCH] mtd: nand/fsmc: Add missing check after DMA map Thomas Fourier
@ 2025-07-01 12:52 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2025-07-01 12:52 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: Richard Weinberger, Vignesh Raghavendra, Uwe Kleine-König,
	David Woodhouse, Viresh Kumar, Artem Bityutskiy, Vipin Kumar,
	linux-mtd, linux-kernel

Hi Thomas,

On 01/07/2025 at 13:55:15 +02, Thomas Fourier <fourier.thomas@gmail.com> wrote:

> The DMA map functions can fail and should be tested for errors.

-The

Same comments as in the other thread, the title should be "mtd: rawnand:
fsmc:" and you miss Cc'ing stable@.

>
> Fixes: 4774fb0a48aa ("mtd: nand/fsmc: Add DMA support")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>

Thanks,
Miquèl

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

end of thread, other threads:[~2025-07-01 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01 11:55 [PATCH] mtd: nand/fsmc: Add missing check after DMA map Thomas Fourier
2025-07-01 12:52 ` Miquel Raynal

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).