Re: [PATCH v1 08/12] PcAtChipsetPkg: Fix conditionally uninitialized variables


Ni, Ray
 

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

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@...>
Sent: Thursday, November 24, 2022 10:01 AM
To: mikuback@...; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@...>
Cc: Erich McMillan <emcmillan@...>; Ni, Ray <ray.ni@...>
Subject: RE: [PATCH v1 08/12] PcAtChipsetPkg: Fix conditionally uninitialized variables

Reviewed-by: Michael D Kinney <michael.d.kinney@...>

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Wednesday, November 9, 2022 9:33 AM
To: devel@edk2.groups.io
Cc: Erich McMillan <emcmillan@...>; Kinney, Michael D <michael.d.kinney@...>; Michael Kubacki
<mikuback@...>; Ni, Ray <ray.ni@...>
Subject: [PATCH v1 08/12] PcAtChipsetPkg: Fix conditionally uninitialized variables

From: Michael Kubacki <michael.kubacki@...>

Fixes CodeQL alerts for CWE-457:
https://cwe.mitre.org/data/definitions/457.html

Cc: Erich McMillan <emcmillan@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Michael Kubacki <mikuback@...>
Cc: Ray Ni <ray.ni@...>
Co-authored-by: Erich McMillan <emcmillan@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 9242a2e82600..57ea3153aa6b 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -344,7 +344,7 @@ PcRtcInit (
// so we can use them to get and set wakeup time.
//
Status = PcRtcGetWakeupTime (&Enabled, &Pending, &Time, Global);
- if ((Enabled) || (!EFI_ERROR (Status))) {
+ if ((!EFI_ERROR (Status)) || (Enabled)) {
return EFI_SUCCESS;
}

@@ -836,8 +836,11 @@ PcRtcSetWakeupTime (
//
// Just support set alarm time within 24 hours
//
- PcRtcGetTime (&RtcTime, &Capabilities, Global);
- Status = RtcTimeFieldsValid (&RtcTime);
+ Status = PcRtcGetTime (&RtcTime, &Capabilities, Global);
+ if (!EFI_ERROR (Status)) {
+ Status = RtcTimeFieldsValid (&RtcTime);
+ }
+
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
--
2.28.0.windows.1

Join devel@edk2.groups.io to automatically receive all group messages.