efi: sandbox: Tidy up copy_fdt() to work with sandbox
authorSimon Glass <sjg@chromium.org>
Wed, 8 Aug 2018 09:54:30 +0000 (03:54 -0600)
committerAlexander Graf <agraf@suse.de>
Sun, 23 Sep 2018 19:55:28 +0000 (21:55 +0200)
commit9dff49008919b235bf93d078c531f2779fff975e
treef34b2884aff46ba5fd5fc002ca1f421822f001a4
parentbaf70c02107a60603234a6871087368dc7bc3764
efi: sandbox: Tidy up copy_fdt() to work with sandbox

At present this function takes a pointer as its argument, then passes this
to efi_allocate_pages(), which actually takes an address. It uses casts,
which are not supported on sandbox.

Also the function calculates the FDT size rounded up to the neared EFI
page size, then its caller recalculates the size and adds a bit more to
it.

This function is much better written as something that works with
addresses only, and returns both the address and the size of the relocated
FDT.

Also, copy_fdt() returns NULL on error, but really should propagate the
error from efi_allocate_pages(). To do this it needs to return an
efi_status_t, not a void *.

Update the code in this way, so that it is easier to follow, and also
supports sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
cmd/bootefi.c