From: Zhang Shurong <zhang_shurong@foxmail.com>
To: neil.armstrong@linaro.org
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,
Zhang Shurong <zhang_shurong@foxmail.com>
Subject: [PATCH] firmware: meson_sm: fix to avoid potential NULL pointer dereference
Date: Sat, 15 Jul 2023 22:13:38 +0800 [thread overview]
Message-ID: <tencent_AA08AAA6C4F34D53ADCE962E188A879B8206@qq.com> (raw)
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,
--
2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Zhang Shurong <zhang_shurong@foxmail.com>
To: neil.armstrong@linaro.org
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,
Zhang Shurong <zhang_shurong@foxmail.com>
Subject: [PATCH] firmware: meson_sm: fix to avoid potential NULL pointer dereference
Date: Sat, 15 Jul 2023 22:13:38 +0800 [thread overview]
Message-ID: <tencent_AA08AAA6C4F34D53ADCE962E188A879B8206@qq.com> (raw)
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,
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Zhang Shurong <zhang_shurong@foxmail.com>
To: neil.armstrong@linaro.org
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,
Zhang Shurong <zhang_shurong@foxmail.com>
Subject: [PATCH] firmware: meson_sm: fix to avoid potential NULL pointer dereference
Date: Sat, 15 Jul 2023 22:13:38 +0800 [thread overview]
Message-ID: <tencent_AA08AAA6C4F34D53ADCE962E188A879B8206@qq.com> (raw)
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,
--
2.30.2
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next reply other threads:[~2023-07-15 14:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-15 14:13 Zhang Shurong [this message]
2023-07-15 14:13 ` [PATCH] firmware: meson_sm: fix to avoid potential NULL pointer dereference Zhang Shurong
2023-07-15 14:13 ` Zhang Shurong
2023-07-31 8:53 ` neil.armstrong
2023-07-31 8:53 ` neil.armstrong
2023-07-31 8:53 ` neil.armstrong
2023-07-31 9:57 ` Neil Armstrong
2023-07-31 9:57 ` Neil Armstrong
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=tencent_AA08AAA6C4F34D53ADCE962E188A879B8206@qq.com \
--to=zhang_shurong@foxmail.com \
--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=neil.armstrong@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.