MdeModulePkg/PciBusDxe: Fix possible uninitialized use

If the function gets invalid value for the `ResizableBarOp` parameter
and asserts are disabled, `Bit` can be used uninitialized.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sergei Dmitrouk <sergei@posteo.net>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Sergei Dmitrouk 2021-05-19 00:09:41 +08:00 committed by mergify[bot]
parent aecfbc81a9
commit 4c79f9bc20
1 changed files with 2 additions and 3 deletions

View File

@ -1778,10 +1778,9 @@ PciProgramResizableBar (
if (ResizableBarOp == PciResizableBarMax) {
Bit = HighBitSet64(Capabilities);
} else if (ResizableBarOp == PciResizableBarMin) {
Bit = LowBitSet64(Capabilities);
} else {
ASSERT ((ResizableBarOp == PciResizableBarMax) || (ResizableBarOp == PciResizableBarMin));
ASSERT (ResizableBarOp == PciResizableBarMin);
Bit = LowBitSet64(Capabilities);
}
ASSERT (Bit >= 0);