]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/SdDxe: Fix potential NULL pointer access
authorJeff Brasen <jbrasen@nvidia.com>
Fri, 16 Nov 2018 08:09:48 +0000 (16:09 +0800)
committerHao Wu <hao.a.wu@intel.com>
Mon, 19 Nov 2018 01:09:05 +0000 (09:09 +0800)
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>
MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c

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