]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/QemuKernelLoaderFsDxe: don't expose kernel command line
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 28 Feb 2020 21:38:50 +0000 (22:38 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 5 Mar 2020 19:45:05 +0000 (19:45 +0000)
We have no need for exposing the kernel command line as a file,
so remove support for that. Since the remaining blobs (kernel
and initrd) are typically much larger than a page, switch to
the page based allocator for blobs at the same time.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2566
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c

index e4539ec2fbe5d19a96abc47e36c73a0bd2644ba9..dc86a48af3789c05e0ee2e8bca542543c4b1da2e 100644 (file)
@@ -30,7 +30,6 @@
 typedef enum {\r
   KernelBlobTypeKernel,\r
   KernelBlobTypeInitrd,\r
-  KernelBlobTypeCommandLine,\r
   KernelBlobTypeMax\r
 } KERNEL_BLOB_TYPE;\r
 \r
@@ -45,7 +44,6 @@ typedef struct {
 STATIC KERNEL_BLOB mKernelBlob[KernelBlobTypeMax] = {\r
   { QemuFwCfgItemKernelSize,      QemuFwCfgItemKernelData,      L"kernel"  },\r
   { QemuFwCfgItemInitrdSize,      QemuFwCfgItemInitrdData,      L"initrd"  },\r
-  { QemuFwCfgItemCommandLineSize, QemuFwCfgItemCommandLineData, L"cmdline" }\r
 };\r
 \r
 STATIC UINT64 mTotalBlobBytes;\r
@@ -865,7 +863,7 @@ FetchBlob (
   //\r
   // Read blob.\r
   //\r
-  Blob->Data = AllocatePool (Blob->Size);\r
+  Blob->Data = AllocatePages (EFI_SIZE_TO_PAGES ((UINTN)Blob->Size));\r
   if (Blob->Data == NULL) {\r
     DEBUG ((DEBUG_ERROR, "%a: failed to allocate %Ld bytes for \"%s\"\n",\r
       __FUNCTION__, (INT64)Blob->Size, Blob->Name));\r
@@ -969,7 +967,8 @@ FreeBlobs:
   while (BlobType > 0) {\r
     CurrentBlob = &mKernelBlob[--BlobType];\r
     if (CurrentBlob->Data != NULL) {\r
-      FreePool (CurrentBlob->Data);\r
+      FreePages (CurrentBlob->Data,\r
+        EFI_SIZE_TO_PAGES ((UINTN)CurrentBlob->Size));\r
       CurrentBlob->Size = 0;\r
       CurrentBlob->Data = NULL;\r
     }\r