mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
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>
This commit is contained in:
parent
728d74973c
commit
ab3f3d7027
@ -1174,11 +1174,19 @@ Done:
|
||||
// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.
|
||||
//
|
||||
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) {
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user