mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Partition: Fix media probe
The call in ProbeMediaStatusEx() to the ReadDisk() function of the
EFI_DISK_IO_PROTOCOL interface implemented in DiskIoDxe/DiskIo.c
crashed in DiskIo2ReadWriteDisk() because of the NULL value of
the destination buffer pointer.
Pass the address of a buffer in the stack instead of a NULL
pointer.
The similar fix was applied to ProbeMediaStatus in commit
df473cc1fc
* MdeModulePkg/PartitionDxe: Fix media probe
Somehow ProbeMediaStatusEx() wasn't changed together.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Tested-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
parent
1db271df76
commit
68599525d8
|
@ -4,7 +4,7 @@
|
||||||
of the raw block devices media. Currently "El Torito CD-ROM", UDF, Legacy
|
of the raw block devices media. Currently "El Torito CD-ROM", UDF, Legacy
|
||||||
MBR, and GPT partition schemes are supported.
|
MBR, and GPT partition schemes are supported.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -777,11 +777,15 @@ ProbeMediaStatusEx (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
UINT8 Buffer[1];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read 1 byte from offset 0 but passing NULL as buffer pointer
|
// Read 1 byte from offset 0 to check if the MediaId is still valid.
|
||||||
|
// The reading operation is synchronious thus it is not worth it to
|
||||||
|
// allocate a buffer from the pool. The destination buffer for the
|
||||||
|
// data is in the stack.
|
||||||
//
|
//
|
||||||
Status = DiskIo2->ReadDiskEx (DiskIo2, MediaId, 0, NULL, 1, NULL);
|
Status = DiskIo2->ReadDiskEx (DiskIo2, MediaId, 0, NULL, 1, (VOID*)Buffer);
|
||||||
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
|
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue