From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web09.4811.1637031219366176058 for ; Mon, 15 Nov 2021 18:53:40 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from localhost.localdomain ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 16 Nov 2021 10:53:36 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: devel@edk2.groups.io Cc: Hao A Wu , Ray Ni Subject: [PATCH] MdeModulePkg AtaAtapiPassThru: Skip the potential NULL pointer access Date: Tue, 16 Nov 2021 10:53:28 +0800 Message-Id: <20211116025328.1604-1-gaoliming@byosoft.com.cn> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3732 Recent change c974257821208fc6191779d1ddea918499f165b8 exposes this potential issue. Signed-off-by: Liming Gao Cc: Hao A Wu Cc: Ray Ni --- 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. -- 2.27.0.windows.1