* [PATCH v2] powerpc: floppy: Add missing checks after DMA map
@ 2025-06-20 7:55 Thomas Fourier
2025-06-20 7:57 ` LEROY Christophe
2025-06-20 7:58 ` Christophe Leroy
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Fourier @ 2025-06-20 7:55 UTC (permalink / raw)
Cc: Thomas Fourier, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, linuxppc-dev, linux-kernel
The DMA map functions can fail and should be tested for errors.
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
arch/powerpc/include/asm/floppy.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
index f8ce178b43b7..34abf8bea2cc 100644
--- a/arch/powerpc/include/asm/floppy.h
+++ b/arch/powerpc/include/asm/floppy.h
@@ -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;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] powerpc: floppy: Add missing checks after DMA map
2025-06-20 7:55 [PATCH v2] powerpc: floppy: Add missing checks after DMA map Thomas Fourier
@ 2025-06-20 7:57 ` LEROY Christophe
2025-06-20 7:58 ` Christophe Leroy
1 sibling, 0 replies; 3+ messages in thread
From: LEROY Christophe @ 2025-06-20 7:57 UTC (permalink / raw)
To: Thomas Fourier
Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Le 20/06/2025 à 09:55, Thomas Fourier a écrit :
> [Vous ne recevez pas souvent de courriers de fourier.thomas@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> 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>
> ---
> arch/powerpc/include/asm/floppy.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
> index f8ce178b43b7..34abf8bea2cc 100644
> --- a/arch/powerpc/include/asm/floppy.h
> +++ b/arch/powerpc/include/asm/floppy.h
> @@ -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;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] powerpc: floppy: Add missing checks after DMA map
2025-06-20 7:55 [PATCH v2] powerpc: floppy: Add missing checks after DMA map Thomas Fourier
2025-06-20 7:57 ` LEROY Christophe
@ 2025-06-20 7:58 ` Christophe Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2025-06-20 7:58 UTC (permalink / raw)
To: Thomas Fourier
Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
linuxppc-dev, linux-kernel
Le 20/06/2025 à 09:55, Thomas Fourier a écrit :
> [Vous ne recevez pas souvent de courriers de fourier.thomas@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> 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>
> ---
> arch/powerpc/include/asm/floppy.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
> index f8ce178b43b7..34abf8bea2cc 100644
> --- a/arch/powerpc/include/asm/floppy.h
> +++ b/arch/powerpc/include/asm/floppy.h
> @@ -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;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-20 9:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 7:55 [PATCH v2] powerpc: floppy: Add missing checks after DMA map Thomas Fourier
2025-06-20 7:57 ` LEROY Christophe
2025-06-20 7:58 ` Christophe Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox