diff options
author | Sergei Dmitrouk <sergei@posteo.net> | 2021-05-19 00:09:41 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-05-19 01:39:49 +0000 |
commit | 4c79f9bc2037e08fa14cb538d19dd43299c17c6d (patch) | |
tree | 24c489bec5d32dfc476fbfdb6c114b8cf84b1fca /MdeModulePkg | |
parent | aecfbc81a98871967595164d431e8ba8adacb601 (diff) | |
download | edk2-4c79f9bc2037e08fa14cb538d19dd43299c17c6d.tar.gz |
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c index 6bba283671..4caac56f1d 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c @@ -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);
|