From: Tomaz Solc <tomaz.solc@tablix.org>
To: barebox@lists.infradead.org
Cc: Tomaz Solc <tomaz.solc@tablix.org>
Subject: [PATCH] ARM: rpi: avoid NULL dereference on unknown rev.
Date: Tue, 12 Feb 2019 15:51:10 +0100 [thread overview]
Message-ID: <20190212145110.13119-1-tomaz.solc@tablix.org> (raw)
"model" pointer is NULL if current board revision isn't in the list of known
boards.
---
arch/arm/boards/raspberry-pi/rpi-common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 650b26ce7..b2febec99 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -180,7 +180,7 @@ const struct rpi_model rpi_models_new_scheme[] = {
};
static int rpi_board_rev = 0;
-const struct rpi_model *model;
+const struct rpi_model *model = NULL;
static void rpi_get_board_rev(void)
{
@@ -251,6 +251,9 @@ unknown_rev:
static void rpi_model_init(void)
{
+ if (!model)
+ return;
+
if (!model->init)
return;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2019-02-12 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 14:51 Tomaz Solc [this message]
2019-02-12 20:15 ` Sascha Hauer
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=20190212145110.13119-1-tomaz.solc@tablix.org \
--to=tomaz.solc@tablix.org \
--cc=barebox@lists.infradead.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