> -----Original Message----- > From: Sergei Dmitrouk <ser...@posteo.net> > Sent: Wednesday, May 19, 2021 12:10 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J <jian.j.w...@intel.com>; Wu, Hao A <hao.a...@intel.com>; > Ni, Ray <ray...@intel.com> > Subject: [PATCH v2 2/3] 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.w...@intel.com> > Cc: Hao A Wu <hao.a...@intel.com> > Cc: Ray Ni <ray...@intel.com> > Signed-off-by: Sergei Dmitrouk <ser...@posteo.net> > --- > > Notes: > v2: > - simplify if-statement to avoid unused branches > > MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c > index 6bba28367165..4caac56f1dcd 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) { > + } else { > + ASSERT (ResizableBarOp == PciResizableBarMin); > Bit = LowBitSet64(Capabilities); > - } else { > - ASSERT ((ResizableBarOp == PciResizableBarMax) || (ResizableBarOp == > PciResizableBarMin));
Reviewed-by: Hao A Wu <hao.a...@intel.com> Best Regards, Hao Wu > } > > ASSERT (Bit >= 0); > -- > 2.17.6 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75295): https://edk2.groups.io/g/devel/message/75295 Mute This Topic: https://groups.io/mt/82915563/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-