Re: [PATCH v2 03/18] kho: return virtual address of mem_map

From: Pratyush Yadav

Date: Mon Jun 15 2026 - 09:14:09 EST


On Sun, Jun 14 2026, Mike Rapoport wrote:

> On Fri, 05 Jun 2026 20:34:36 +0200, Pratyush Yadav <pratyush@xxxxxxxxxx> wrote:
>> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
>> index e8454dc5b489..d8dd0ede4f87 100644
>> --- a/kernel/liveupdate/kexec_handover.c
>> +++ b/kernel/liveupdate/kexec_handover.c
>> @@ -521,7 +522,11 @@ static phys_addr_t __init kho_get_mem_map_phys(const void *fdt)
>> return 0;
>
> sashiko:
>
> Does this error path need to be updated to return NULL?
> Since the function signature was changed to return a void pointer
> instead of phys_addr_t, returning a plain integer 0 instead of NULL
> might trigger static analysis warnings.

Good catch, will fix.

>
>> @@ -1668,8 +1672,8 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
>> goto unmap_fdt;
>> }
>>
>> - mem_map_phys = kho_get_mem_map_phys(fdt);
>> - if (!mem_map_phys)
>> + mem_map = kho_get_mem_map(fdt);
>> + if (!mem_map)
>
> Here we can't use mem_map as an actual pointer because phys_to_virt()
> returns pre-KASLR addres.

Ugh, yeah. It also won't work on ARM64 because memstart_addr is not set
at this point.

>
> Since we only call get_mem_map() here to verify that it's available in
> the FDT and don't care about the actual virtual address, let's add a
> comment about that, drop the mem_map varialble and directly check
>
> if (!kho_get_mem_map_phys())

Makes sense. Will do.

--
Regards,
Pratyush Yadav