MdeModulePkg/SdDxe: Fix potential NULL pointer access

SdReadWrite can be called with a NULL Token for synchronous operations.
Add guard for DEBUG print to only print event pointer with Token is not
NULL.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Jeff Brasen 2018-11-16 16:09:48 +08:00 committed by Hao Wu
parent 90fa59f685
commit 5a16ba3ae1
1 changed files with 3 additions and 2 deletions

View File

@ -670,8 +670,9 @@ SdReadWrite (
if (EFI_ERROR (Status)) {
return Status;
}
DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status));
DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n",
IsRead ? "Read" : "Write", Lba, BlockNum,
(Token != NULL) ? Token->Event : NULL, Status));
Lba += BlockNum;
Buffer = (UINT8*)Buffer + BufferSize;
Remaining -= BlockNum;