]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Core/Dxe/Image/Image.c
MdeModulePkg/DxeCore: Please static checker for false report
authorHao Wu <hao.a.wu@intel.com>
Mon, 22 Apr 2019 05:42:18 +0000 (13:42 +0800)
committerHao Wu <hao.a.wu@intel.com>
Sun, 28 Apr 2019 00:31:38 +0000 (08:31 +0800)
commitdfaa565559ba28a3b78c0f42b2480d28cecb7382
tree6a36de88e98d0e4a6515b0e154621b58c25cf95c
parent20029ca22baaeb9418c1fd9df88d12d32d585cb6
MdeModulePkg/DxeCore: Please static checker for false report

After commit 57df17fe26, some static check reports suspicious NULL pointer
deference at line:

  Entry->MachineType = Entry->Emulator->MachineType;
                       ^^^^^^^^^^^^^^^

within function PeCoffEmuProtocolNotify().

However, 'Entry->Emulator' is guaranteed to have a non-NULL value when
previous call to the CoreHandleProtocol() returns EFI_SUCCESS.

This commit will re-write the return status check for CoreHandleProtocol()
to add explicit NULL pointer check for protocol instance pointer.

Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
MdeModulePkg/Core/Dxe/Image/Image.c