Skip to content

Commit 6c4dab3

Browse files
Thomas-fouriermiquelraynal
authored andcommitted
mtd: rawnand: fsmc: Add missing check after DMA map
The DMA map functions can fail and should be tested for errors. Fixes: 4774fb0 ("mtd: nand/fsmc: Add DMA support") Cc: [email protected] Signed-off-by: Thomas Fourier <[email protected]> Rule: add Link: https://lore.kernel.org/stable/20250702065806.20983-2-fourier.thomas%40gmail.com Signed-off-by: Miquel Raynal <[email protected]>
1 parent 3b36f86 commit 6c4dab3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/mtd/nand/raw/fsmc_nand.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ static int dma_xfer(struct fsmc_nand_data *host, void *buffer, int len,
503503

504504
dma_dev = chan->device;
505505
dma_addr = dma_map_single(dma_dev->dev, buffer, len, direction);
506+
if (dma_mapping_error(dma_dev->dev, dma_addr))
507+
return -EINVAL;
506508

507509
if (direction == DMA_TO_DEVICE) {
508510
dma_src = dma_addr;

0 commit comments

Comments
 (0)