public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Star Zeng <star.zeng@intel.com>,
	Steven Shi <steven.shi@intel.com>,
	Eric Dong <eric.dong@intel.com>
Subject: [PATCH v2] MdeModulePkg/AtaPassThru: Add missing NULL ptr check in BindingStart
Date: Thu, 28 Jun 2018 09:38:53 +0800	[thread overview]
Message-ID: <20180628013853.20948-1-hao.a.wu@intel.com> (raw)

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

Within function AtaAtapiPassThruStart():
Add missing NULL pointer check for variable 'Instance' under the
'ErrorExit' code logics.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
index aab704bcd3..4108bafd85 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
@@ -827,12 +827,11 @@ ErrorExit:
     gBS->CloseEvent (Instance->TimerEvent);
   }
 
-  //
-  // Remove all inserted ATA devices.
-  //
-  DestroyDeviceInfoList(Instance);
-
   if (Instance != NULL) {
+    //
+    // Remove all inserted ATA devices.
+    //
+    DestroyDeviceInfoList (Instance);
     FreePool (Instance);
   }
   return EFI_UNSUPPORTED;
-- 
2.12.0.windows.1



             reply	other threads:[~2018-06-28  1:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28  1:38 Hao Wu [this message]
2018-06-28  1:40 ` [PATCH v2] MdeModulePkg/AtaPassThru: Add missing NULL ptr check in BindingStart Wu, Hao A
2018-06-29  8:45   ` Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628013853.20948-1-hao.a.wu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox