diff options
author | Hao Wu <hao.a.wu@intel.com> | 2017-09-28 09:11:36 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2017-10-09 10:45:31 +0800 |
commit | ab3f3d7027483f030b92a665c92d5b07eeee2297 (patch) | |
tree | af4399a3dc118ace007e151d6d44d17da43c67c3 /MdeModulePkg/Core/Dxe | |
parent | 728d74973c9262b6c7b7ef4be213223d55affec3 (diff) | |
download | edk2-ab3f3d7027483f030b92a665c92d5b07eeee2297.tar.gz edk2-ab3f3d7027483f030b92a665c92d5b07eeee2297.tar.bz2 edk2-ab3f3d7027483f030b92a665c92d5b07eeee2297.zip |
MdeModulePkg/DxeCore: Add comments for the ASSERT to check NULL ptr
Commit 8932679df5be046feba30fae80776c5815232a08 adds an ASSERT for
checking NULL pointer dereference.
The ASSERT added here is for addressing a false positive NULL pointer
dereference issue raised from static analysis.
This commit adds comments to clarify the reason for using ASSERT as the
check.
Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Hand/Handle.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 2db441725c..86a4065733 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1175,10 +1175,18 @@ Done: //
if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) {
//
+ // According to above logic, if 'Prot' is NULL, then the 'Status' must be
+ // EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so 'Prot'
+ // must be not NULL.
+ //
+ // The ASSERT here is for addressing a false positive NULL pointer
+ // dereference issue raised from static analysis.
+ //
+ ASSERT (Prot != NULL);
+ //
// EFI_ALREADY_STARTED is not an error for bus driver.
// Return the corresponding protocol interface.
//
- ASSERT (Prot != NULL);
*Interface = Prot->Interface;
} else if (Status == EFI_UNSUPPORTED) {
//
|