From: Liming Gao Date: Tue, 16 Nov 2021 02:52:07 +0000 (+0800) Subject: MdeModulePkg AtaAtapiPassThru: Skip the potential NULL pointer access X-Git-Tag: edk2-stable202202~301 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=4c7ce0d285bc7fd593718fd5dec02e136cbfad8e 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 --- 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.