On Sat, 8 Mar 2025 at 19:04, Ben Schneider <ben@xxxxxxxxx> wrote: > > Hi Ard, I am finding when trying to decompress a zboot compressed > kernel, efi_random_alloc() is returning EFI_NOT_FOUND to > efi_zboot_entry() which causes it to stop. > > I think this is happening because the second for loop in > efi_random_alloc() seems to always break after only one > iteration[1], and the first address it tries to ask for is > reserved on my device. I suspect this behavior is not > intentional--otherwise why have a loop at all. Also, when I block > the break statement with the preceding if (status == EFI_SUCCESS), > decompression proceeds as expected. > The code is a bit cryptic, but what happens is that the second loop only considers memory regions that were found to be available during the first loop. In this case, MD_NUM_SLOTS() is set to a non-zero value, whereas it is set to 0x0 for regions that are not available. In the latter case, the second 'continue' statement will always be reached, and so the loop advances to the next region. What firmware are you using? Can you share the contents of the EFI memory map?