From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.27817.1678473937119046049 for ; Fri, 10 Mar 2023 10:45:37 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=XU4lvp8R; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.201.8.94]) by linux.microsoft.com (Postfix) with ESMTPSA id 3BD3C20C14D5; Fri, 10 Mar 2023 10:45:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3BD3C20C14D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1678473936; bh=2WQw6MO1CUeaZWkn4mXpdpaJLBBgl86JbRgb8ID070c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XU4lvp8RawA0XYx4L41CUAnYd4soKD3QHOC5DinZS1giVBmtIEuXca8NbhhzoXErL JxFnW2SXzhPssRILA4CYwynd4B4XH0jO59M0xrUOsrX8g3NOOLuRryNmrpnT7XQNsg n9LNehv5DiSOlfVV8eZYWwZOL2i2VHjbt8FloTzE= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Erich McMillan , Michael D Kinney , Michael Kubacki , Ray Ni Subject: [PATCH v4 08/12] PcAtChipsetPkg: Fix conditionally uninitialized variables Date: Fri, 10 Mar 2023 13:42:34 -0500 Message-Id: <20230310184238.2999-9-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.39.2.windows.1 In-Reply-To: <20230310184238.2999-1-mikuback@linux.microsoft.com> References: <20230310184238.2999-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki Fixes CodeQL alerts for CWE-457: https://cwe.mitre.org/data/definitions/457.html Cc: Erich McMillan Cc: Michael D Kinney Cc: Michael Kubacki Cc: Ray Ni Co-authored-by: Erich McMillan Signed-off-by: Michael Kubacki Reviewed-by: Michael D Kinney Reviewed-by: Ray Ni --- PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChi= psetPkg/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 =3D PcRtcGetWakeupTime (&Enabled, &Pending, &Time, Global); - if ((Enabled) || (!EFI_ERROR (Status))) { + if ((!EFI_ERROR (Status)) || (Enabled)) { return EFI_SUCCESS; } =20 @@ -836,8 +836,11 @@ PcRtcSetWakeupTime ( // // Just support set alarm time within 24 hours // - PcRtcGetTime (&RtcTime, &Capabilities, Global); - Status =3D RtcTimeFieldsValid (&RtcTime); + Status =3D PcRtcGetTime (&RtcTime, &Capabilities, Global); + if (!EFI_ERROR (Status)) { + Status =3D RtcTimeFieldsValid (&RtcTime); + } + if (EFI_ERROR (Status)) { return EFI_DEVICE_ERROR; } --=20 2.39.2.windows.1