From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Salah Triki <salah.triki@gmail.com>,
Ioana Ciornei <ioana.ciornei@nxp.com>,
Markus Elfring <Markus.Elfring@web.de>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] bus: fsl-mc: Check return value of platform_get_resource()
Date: Mon, 22 Sep 2025 16:57:09 +0200 [thread overview]
Message-ID: <31c6a5ad-08ac-46b2-9362-84484482bd06@csgroup.eu> (raw)
In-Reply-To: <aKwuK6TRr5XNYQ8u@pc>
Le 25/08/2025 à 11:34, Salah Triki a écrit :
> [Vous ne recevez pas souvent de courriers de salah.triki@gmail.com. D?couvrez pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification ]
>
> platform_get_resource() returns NULL in case of failure, so check its
> return value and propagate the error in order to prevent NULL pointer
> dereference.
>
> Fixes: 6305166c8771 ("bus: fsl-mc: Add ACPI support for fsl-mc")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> Changes in v2:
> - Add Fixes and Cc tags, as suggested by Markus Elfring and Christophe
> Leroy.
> - Remove blank line before the if statement, as suggested by Markus
> Elfring.
> - Replace ENODEV with EINVAL, as suggestd by Christophe Leroy.
>
> drivers/bus/fsl-mc/fsl-mc-bus.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index 7671bd158545..cd83cd564736 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -1105,6 +1105,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
> * Get physical address of MC portal for the root DPRC:
> */
> plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!plat_res)
> + return -EINVAL;
> +
> mc_portal_phys_addr = plat_res->start;
> mc_portal_size = resource_size(plat_res);
> mc_portal_base_phys_addr = mc_portal_phys_addr & ~0x3ffffff;
> --
> 2.43.0
>
Applied, thanks!
Christophe
prev parent reply other threads:[~2025-09-22 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 9:34 Salah Triki
2025-08-25 15:46 ` Ioana Ciornei
2025-09-22 14:57 ` 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=31c6a5ad-08ac-46b2-9362-84484482bd06@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=Markus.Elfring@web.de \
--cc=ioana.ciornei@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=salah.triki@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®