From a300ecc55bc9c87e833527e67ce0a804984c00c2 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 1 Feb 2025 00:02:32 +0100 Subject: [PATCH] kboot: Prevent NULL pointer dereference in dt_set_display() dt_set_display() relied on display_get_config() returning the default config entry as it is only interested on the device tree alias for the primary dcp. This is always "dcp" except for devices with a config. Since commit 8508526 ("display: contain all display init logic within display.c") it however returns NULL if ADT dcp node specified in the config does not exists. This is the case for M2 Pro and Max macbooks which use "dcp0" instead of "dcp". Fixes: 8508526 ("display: contain all display init logic within display.c") Signed-off-by: Janne Grunau --- src/kboot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kboot.c b/src/kboot.c index 97a9171d6..969d4194e 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -1888,7 +1888,10 @@ static int dt_set_display(void) const display_config_t *disp_cfg = display_get_config(); - return dt_vram_reserved_region(disp_cfg->dcp_alias, "disp0"); + if (disp_cfg) + return dt_vram_reserved_region(disp_cfg->dcp_alias, "disp0"); + else + return dt_vram_reserved_region("dcp", "disp0"); } static int dt_set_sep(void)