summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiming Gao <gaoliming@byosoft.com.cn>2021-11-16 10:52:07 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-11-24 15:25:07 +0000
commit4c7ce0d285bc7fd593718fd5dec02e136cbfad8e (patch)
treefff7a160925fc12d0d9cded38bf41a23960a9749
parente1e7306b54147e65cb7347b060e94f336d4a82d2 (diff)
downloadedk2-4c7ce0d285bc7fd593718fd5dec02e136cbfad8e.tar.gz
edk2-4c7ce0d285bc7fd593718fd5dec02e136cbfad8e.tar.bz2
edk2-4c7ce0d285bc7fd593718fd5dec02e136cbfad8e.zip
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 <gaoliming@byosoft.com.cn> Acked-by: Rebecca Cran <rebecca@nuviainc.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c7
1 files changed, 7 insertions, 0 deletions
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
@@ -886,6 +886,13 @@ AhciPrintStatusBlock (
)
{
//
+ // 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.
//