MdeModulePkg/SdDxe: Check the Token to avoid null pointer

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286

Token pointer may be NULL, it should be checked before use it.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Guomin Jiang 2020-03-26 14:35:54 +08:00 committed by mergify[bot]
parent a1c35ff312
commit 695d90b9b1
1 changed files with 8 additions and 1 deletions

View File

@ -1367,7 +1367,14 @@ SdEraseBlocks (
return Status;
}
DEBUG ((EFI_D_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", Lba, BlockNum, Token->Event, Status));
DEBUG ((
DEBUG_INFO,
"SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n",
Lba,
BlockNum,
(Token != NULL) ? Token->Event : NULL,
Status
));
return Status;
}