From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc: floppy: Add missing checks after DMA map
Date: Fri, 20 Jun 2025 09:44:55 +0200 [thread overview]
Message-ID: <16e789a6-87f4-4f7a-9f13-edf47f9f401f@csgroup.eu> (raw)
In-Reply-To: <20250619110739.323202-2-fourier.thomas@gmail.com>
Hi Thomas,
Le 19/06/2025 à 13:07, 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>
> ---
> arch/powerpc/include/asm/floppy.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/floppy.h b/arch/powerpc/include/asm/floppy.h
> index f8ce178b43b7..df8ce2ae636d 100644
> --- a/arch/powerpc/include/asm/floppy.h
> +++ b/arch/powerpc/include/asm/floppy.h
> @@ -144,9 +144,14 @@ 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)) {
> + bus_addr = 0;
bus_addr is a local variable, there is no point in setting it to zero
here. Just return -ENOMEM.
> + return -ENOMEM;
> + }
> + }
>
> /* remember this one as prev */
> prev_addr = addr;
> --
> 2.43.0
>
prev parent reply other threads:[~2025-06-20 7:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 11:07 Thomas Fourier
2025-06-20 7:44 ` Christophe Leroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16e789a6-87f4-4f7a-9f13-edf47f9f401f@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=fourier.thomas@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®