]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
powerpc: floppy: Add missing checks after DMA map
authorThomas Fourier <fourier.thomas@gmail.com>
Fri, 20 Jun 2025 07:55:55 +0000 (09:55 +0200)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Mon, 23 Jun 2025 04:32:52 +0000 (10:02 +0530)
The DMA map functions can fail and should be tested for errors.

Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250620075602.12575-1-fourier.thomas@gmail.com
arch/powerpc/include/asm/floppy.h

index f8ce178b43b78386e5a620eac8e72cdf01bb8394..34abf8bea2ccd6d712f7c13839f626e3ee829f47 100644 (file)
@@ -144,9 +144,12 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
                bus_addr = 0;
        }
 
-       if (!bus_addr)  /* need to map it */
+       if (!bus_addr) {        /* need to map it */
                bus_addr = dma_map_single(&isa_bridge_pcidev->dev, addr, size,
                                          dir);
+               if (dma_mapping_error(&isa_bridge_pcidev->dev, bus_addr))
+                       return -ENOMEM;
+       }
 
        /* remember this one as prev */
        prev_addr = addr;