Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: dd49d448b0815c65847241a3faa957e3b4605001
      
https://github.com/tianocore/edk2/commit/dd49d448b0815c65847241a3faa957e3b4605001
  Author: Ranbir Singh <[email protected]>
  Date:   2023-07-17 (Mon, 17 Jul 2023)

  Changed paths:
    M MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c

  Log Message:
  -----------
  MdeModulePkg/Bus/Pci/EhciDxe: Fix FORWARD_NULL Coverity issues

The function UsbHcGetPciAddressForHostMem has

    ASSERT ((Block != NULL));

and the UsbHcFreeMem has

    ASSERT (Block != NULL);

statement after for loop, but these are applicable only in DEBUG mode.
In RELEASE mode, if for whatever reasons there is no match inside the
for loop and the loop exits because of Block != NULL; condition, then
there is no "Block" NULL pointer check afterwards and the code proceeds
to do dereferencing "Block" which will lead to CRASH.

Hence, for safety add NULL pointer checks always.

Cc: Hao A Wu <[email protected]>
Cc: Ray Ni <[email protected]>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4210
Signed-off-by: Ranbir Singh <[email protected]>
Signed-off-by: Ranbir Singh <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>




_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to