ARM: rpi: avoid NULL dereference on unknown rev.
PATCH 1/1 ARM: rpi: avoid NULL dereference on unknown rev.
"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(-)
arch/arm/boards/raspberry-pi/rpi-common.c +4 -1
@@ -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 ;
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 5 lines · Tomaz Solc
"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(-)
Applied, thanks
Sascha
Quoted 33 lines
arch/arm/boards/raspberry-pi/rpi-common.c +4
-1@@ -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 ;Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox