Skip to contentSkip to conversation

mtd: nand/fsmc: Add missing check after DMA map

PATCH Superseded Thomas Fourier 2 participants 2 messages Jul 1, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nand/fsmc: Add missing check after DMA map

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

Fixes 4774fb0a48aa ("mtd: nand/fsmc: Add DMA support")
---
 drivers/mtd/nand/raw/fsmc_nand.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/nand/raw/fsmc_nand.c +2 -0
index d579d5dd60d6..df61db8ce466 100644
@@ -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;
Signature · 1 line
2.43.0
maintainer
#1 lore raw

Hi Thomas,

Quoted 1 line · Thomas Fourier

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

Quoted 3 lines
Fixes 4774fb0a48aa ("mtd: nand/fsmc: Add DMA support")

Thanks,
Miquèl