]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/PartitionDxe: Fix media probe
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / Partition.c
index 28639b0117c6899f527b88f04604f5c0d6462b72..89cc540210efaaa9ee3d053f466887e7a7e85395 100644 (file)
@@ -576,11 +576,15 @@ ProbeMediaStatus (
   )\r
 {\r
   EFI_STATUS                 Status;\r
+  UINT8                      Buffer[1];\r
 \r
   //\r
-  // Read 1 byte from offset 0 but passing NULL as buffer pointer\r
+  // Read 1 byte from offset 0 to check if the MediaId is still valid.\r
+  // The reading operation is synchronious thus it is not worth it to\r
+  // allocate a buffer from the pool. The destination buffer for the\r
+  // data is in the stack.\r
   //\r
-  Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, NULL);\r
+  Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, (VOID*)Buffer);\r
   if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {\r
     return Status;\r
   }\r