Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray

From: Ranbir Singh <rsingh@ventanamicro.com>
Sent: Tuesday, November 7, 2023 2:19 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; rsingh@ventanamicro.com <rsingh@ventanamicro.com>
Cc: Ni, Ray <ray.ni@intel.com>; Veeresh Sangolli <veeresh.sangolli@dellteam.com>
Subject: [PATCH v2 2/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix MISSING_BREAK Coverity issues
 
From: Ranbir Singh <Ranbir.Singh3@Dell.com>

The function UpdatePciInfo has switch-case code in which there are fall
through from case 32: to case 64:. While this is seeemingly intentional,
it is not evident to any general code reader why there is no break; in
between. Adding

    // No break; here as this is an intentional fallthrough.

as comment in between makes it explicit. Incidentally, the comment
satisfies Coverity as well.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4239

Cc: Ray Ni <ray.ni@intel.com>
Co-authored-by: Veeresh Sangolli <veeresh.sangolli@dellteam.com>
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
Signed-off-by: Ranbir Singh <rsingh@ventanamicro.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 6594b8eae83f..eda97285ee18 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1428,6 +1428,9 @@ UpdatePciInfo (
               switch (Ptr->AddrSpaceGranularity) {

                 case 32:

                   PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem32;

+                  //

+                  // No break; here as this is an intentional fall through.

+                  //

                 case 64:

                   PciIoDevice->PciBar[BarIndex].BarTypeFixed = TRUE;

                   break;

@@ -1440,6 +1443,9 @@ UpdatePciInfo (
               switch (Ptr->AddrSpaceGranularity) {

                 case 32:

                   PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32;

+                  //

+                  // No break; here as this is an intentional fall through.

+                  //

                 case 64:

                   PciIoDevice->PciBar[BarIndex].BarTypeFixed = TRUE;

                   break;

--
2.34.1

_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#110821) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_