From: neil.armstrong@linaro.org
To: Zhang Shurong <zhang_shurong@foxmail.com>
Cc: khilman@baylibre.com, jbrunet@baylibre.com,
martin.blumenstingl@googlemail.com,
linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: meson_sm: fix to avoid potential NULL pointer dereference
Date: Mon, 31 Jul 2023 10:53:02 +0200 [thread overview]
Message-ID: <768ae986-a67b-fedc-d43b-94096d1dd6bb@linaro.org> (raw)
In-Reply-To: <tencent_AA08AAA6C4F34D53ADCE962E188A879B8206@qq.com>
On 15/07/2023 16:13, Zhang Shurong wrote:
> of_match_device() may fail and returns a NULL pointer.
>
> Fix this by checking the return value of of_match_device.
>
> Fixes: 8cde3c2153e8 ("firmware: meson_sm: Rework driver as a proper platform driver")
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
> ---
> drivers/firmware/meson/meson_sm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index 798bcdb05d84..9a2656d73600 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -292,6 +292,8 @@ static int __init meson_sm_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> chip = of_match_device(meson_sm_ids, dev)->data;
> + if (!chip)
> + return -EINVAL;
>
> if (chip->cmd_shmem_in_base) {
> fw->sm_shmem_in_base = meson_sm_map_shmem(chip->cmd_shmem_in_base,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2023-07-31 8:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-15 14:13 Zhang Shurong
2023-07-31 8:53 ` neil.armstrong [this message]
2023-07-31 9:57 ` Neil Armstrong
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=768ae986-a67b-fedc-d43b-94096d1dd6bb@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=zhang_shurong@foxmail.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®