The function kho_update_memory_map currently does not check if the pointer returned by fdt_getprop_w is NULL. If the pointer is NULL, subsequent operations such as dereferencing the pointer or using it in unaligned access functions could cause undefined behavior or crashes. Prevent that. Signed-off-by: Zhan Xusheng --- kernel/liveupdate/kexec_handover.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c index cc68a3692905..f6ad87930003 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -397,6 +397,8 @@ static void kho_update_memory_map(struct khoser_mem_chunk *first_chunk) u64 phys; ptr = fdt_getprop_w(kho_out.fdt, 0, KHO_FDT_MEMORY_MAP_PROP_NAME, NULL); + if (!ptr) + return; /* Check and discard previous memory map */ phys = get_unaligned((u64 *)ptr); -- 2.43.0