From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linuxppc-dev@lists.ozlabs.org>
Cc: <michael@walle.cc>, <arnd@arndb.de>, <shawnguo@kernel.org>
Subject: [PATCH -next 2/2] soc: fsl: guts: check return value after calling of_iomap() in fsl_guts_get_soc_uid()
Date: Tue, 28 Jun 2022 22:02:49 +0800 [thread overview]
Message-ID: <20220628140249.1073809-2-yangyingliang@huawei.com> (raw)
In-Reply-To: <20220628140249.1073809-1-yangyingliang@huawei.com>
of_iomap() may return NULL, so we need check the return value.
Fixes: 786dde1e59d7 ("soc: fsl: guts: add serial_number support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/soc/fsl/guts.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 8038c599ad83..6bf3e6a980ff 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -126,6 +126,10 @@ static u64 fsl_guts_get_soc_uid(const char *compat, unsigned int offset)
return 0;
sfp_base = of_iomap(np, 0);
+ if (!sfp_base) {
+ of_node_put(np);
+ return 0;
+ }
uid = ioread32(sfp_base + offset);
uid <<= 32;
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-28 13:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 14:02 [PATCH -next 1/2] soc: fsl: guts: fix return value check in fsl_guts_init() Yang Yingliang
2022-06-28 14:02 ` Yang Yingliang [this message]
2022-06-28 14:29 ` [PATCH -next 2/2] soc: fsl: guts: check return value after calling of_iomap() in fsl_guts_get_soc_uid() Michael Walle
2022-06-28 14:27 ` [PATCH -next 1/2] soc: fsl: guts: fix return value check in fsl_guts_init() Michael Walle
2022-07-05 0:42 ` Shawn Guo
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=20220628140249.1073809-2-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=michael@walle.cc \
--cc=shawnguo@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox