diff --git a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c index 4968d2b478..c6f2c72650 100644 --- a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c +++ b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c @@ -303,6 +303,13 @@ InsertPciCap ( // not the first instance of (Domain, CapId). // if (PciCap->Key.Instance > 0) { + // + // Suppress invalid "nullptr dereference" compiler/analyzer warnings: the + // only way for "PciCap->Key.Instance" to be positive here is for it to + // have been assigned *from* dereferencing "InstanceZero" above. + // + ASSERT (InstanceZero != NULL); + InstanceZero->NumInstancesUnion.NumInstances++; } return RETURN_SUCCESS;