diff options
author | Laszlo Ersek <lersek@redhat.com> | 2019-04-12 16:45:58 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2019-04-18 16:04:18 +0200 |
commit | dc5bbf10741cb385f4357e33e214b7ba23085432 (patch) | |
tree | df2514f652ee85ebd6a15574b2dec3d39b20c8ea /OvmfPkg/README | |
parent | 52d229238b2d3a24347d1ff9c2c3f884e51a3e1c (diff) | |
download | edk2-dc5bbf10741cb385f4357e33e214b7ba23085432.tar.gz edk2-dc5bbf10741cb385f4357e33e214b7ba23085432.tar.bz2 edk2-dc5bbf10741cb385f4357e33e214b7ba23085432.zip |
OvmfPkg/AcpiPlatformDxe: suppress invalid "deref of undef pointer" warning
RH covscan emits the following false positive:
> Error: CLANG_WARNING:
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:182:14:
> warning: Dereference of undefined pointer value
> # Status = FwVol->ReadSection (
> # ^~~~~~~~~~~~~~~~~~
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:164:7: note:
> Assuming the condition is false
> # if (QemuDetected ()) {
> # ^~~~~~~~~~~~~~~
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:164:3: note:
> Taking false branch
> # if (QemuDetected ()) {
> # ^
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:174:3: note:
> Taking false branch
> # if (EFI_ERROR (Status)) {
> # ^
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:180:10: note:
> Assuming 'Status' is equal to EFI_SUCCESS
> # while (Status == EFI_SUCCESS) {
> # ^~~~~~~~~~~~~~~~~~~~~
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:180:3: note:
> Loop condition is true. Entering loop body
> # while (Status == EFI_SUCCESS) {
> # ^
> edk2-89910a39dcfd/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c:182:14: note:
> Dereference of undefined pointer value
> # Status = FwVol->ReadSection (
> # ^~~~~~~~~~~~~~~~~~
> # 180| while (Status == EFI_SUCCESS) {
> # 181|
> # 182|-> Status = FwVol->ReadSection (
> # 183| FwVol,
> # 184| (EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
This is invalid because LocateFvInstanceWithTables() sets FwVol on
success.
Suppress the message by:
- assigning FwVol NULL first (this would replace the original report with
"nullptr deref"),
- asserting that FwVol is no longer NULL, on success.
What's important here is that ASSERT() ends with ANALYZER_UNREACHABLE() on
failure.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1710
Issue: scan-0991.txt
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'OvmfPkg/README')
0 files changed, 0 insertions, 0 deletions