summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Brasen <jbrasen@nvidia.com>2018-11-16 16:09:48 +0800
committerHao Wu <hao.a.wu@intel.com>2018-11-19 09:09:05 +0800
commit5a16ba3ae18e6528cb83039951e15a4b76004949 (patch)
treeb614cf784707e1ca986bc90affe2d8460d5d2c59
parent90fa59f6857388231688675813fa43e068267214 (diff)
downloadedk2-5a16ba3ae18e6528cb83039951e15a4b76004949.tar.gz
edk2-5a16ba3ae18e6528cb83039951e15a4b76004949.tar.bz2
edk2-5a16ba3ae18e6528cb83039951e15a4b76004949.zip
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>
-rw-r--r--MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
index b8d115abac..a4695ffe4d 100644
--- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
+++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
@@ -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;