On Mon, Mar 02, 2015 at 01:03:52PM +0100, Laszlo Ersek wrote:
> When the user doesn't pass a kernel with QEMU's "-kernel" switch, the
> firmware sees a zero-sized kernel blob via the QemuFwCfgItemKernelSize
> key; there's no way to distinguish "no kernel" from "zero sized kernel".
> In both cases TryRunningQemuKernel() proceeds as far as gBS->LoadImage(),
> which then rejects the zero sized synthetic file with EFI_UNSUPPORTED.
> 
> This is known and works fully as expected; however we should rather catch
> the much more frequent "no kernel" case earlier, in order to avoid the
> EFI_D_ERROR message
> 
>   TryRunningQemuKernel: LoadImage(): Unsupported
> 
> which is arguably meaningless noise for the "no kernel" case.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <ler...@redhat.com>
> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
> ---
>  ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/QemuKernel.c 
> | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git 
> a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/QemuKernel.c
>  
> b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/QemuKernel.c
> index abcac77..21545f0 100644
> --- 
> a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/QemuKernel.c
> +++ 
> b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/QemuKernel.c
> @@ -949,6 +949,11 @@ TryRunningQemuKernel (
>    InitrdBlob      = &mKernelBlob[KernelBlobTypeInitrd];
>    CommandLineBlob = &mKernelBlob[KernelBlobTypeCommandLine];
>  
> +  if (KernelBlob->Data == NULL) {
> +    Status = EFI_NOT_FOUND;
> +    goto FreeBlobs;
> +  }
> +

Minor nitpick:
This test could go directly after
  KernelBlob      = &mKernelBlob[KernelBlobTypeKernel];

>    //
>    // Create a new handle with a single VenHw() node device path protocol on 
> it,
>    // plus a custom SimpleFileSystem protocol on it.
> -- 
> 1.8.3.1

With or without modification:
Reviewed-by: Leif Lindholm <leif.lindh...@linaro.org>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to