From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Sergei Dmitrouk <sergei@posteo.net>, "Ni, Ray" <ray.ni@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>
Subject: Re: [PATCH v2 2/3] MdeModulePkg/PciBusDxe: Fix possible uninitialized use
Date: Wed, 19 May 2021 01:08:34 +0000 [thread overview]
Message-ID: <BN8PR11MB3666A891B5FAAA80C05AB0D8CA2B9@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210518160942.17634-3-sergei@posteo.net>
> -----Original Message-----
> From: Sergei Dmitrouk <sergei@posteo.net>
> Sent: Wednesday, May 19, 2021 12:10 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@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.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>
> ---
>
> 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.wu@intel.com>
Best Regards,
Hao Wu
> }
>
> ASSERT (Bit >= 0);
> --
> 2.17.6
next prev parent reply other threads:[~2021-05-19 1:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 16:09 [PATCH v1 0/3] Fix possible uninitialized uses Sergei Dmitrouk
2021-05-18 16:09 ` [PATCH v2 1/3] ShellPkg/HttpDynamicCommand: Fix possible uninitialized use Sergei Dmitrouk
2021-05-19 1:13 ` 回复: [edk2-devel] " gaoliming
2021-05-19 2:21 ` Gao, Zhichao
2021-05-18 16:09 ` [PATCH v2 2/3] MdeModulePkg/PciBusDxe: " Sergei Dmitrouk
2021-05-19 1:08 ` Wu, Hao A [this message]
2021-05-18 16:09 ` [PATCH v2 3/3] CryptoPkg/BaseCryptLib: " Sergei Dmitrouk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN8PR11MB3666A891B5FAAA80C05AB0D8CA2B9@BN8PR11MB3666.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox