From 4c7ce0d285bc7fd593718fd5dec02e136cbfad8e Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Tue, 16 Nov 2021 10:52:07 +0800 Subject: MdeModulePkg AtaAtapiPassThru: Skip the potential NULL pointer access BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3732 Recent change c9742578 exposes this potential issue. Signed-off-by: Liming Gao Acked-by: Rebecca Cran Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c index 7626bac38d..bda900a161 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c @@ -885,6 +885,13 @@ AhciPrintStatusBlock ( IN UINT32 DebugLevel ) { + // + // Skip NULL pointer + // + if (AtaStatusBlock == NULL) { + return; + } + // // Only print status and error since we have all of the rest printed as // a part of command block print. -- cgit v1.2.3