From nobody Fri Dec 19 18:44:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96152+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96152+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1668015204; cv=none; d=zohomail.com; s=zohoarc; b=TrSI7gqkgJhoIb8HCU207bGwKsm5H2IVJhnAVX+ffoHAK+wtAyqAJtbGdKpriExNYr2mzJTEkeee789J3PFGUK8M/pvsWdaq+R/DX/fELfRLvluuNL4PFZzXVU9kak+9XjbiK55n7Dhs3TAb+WbWhylH2coNgYdLlvqMku0tPq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668015204; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1j4fgWujMjp0ZX9aaFYCnN+180XbvLaoxsRvmuAhWCI=; b=Ig37ai00abXGCLXYtKUoIILaGDCdFrGOoprh3zon+2AUMipc9g3y5cu5obQ/tgbVDN7e+UqEDm+OnhRLirp2TiFdGPy1aC6yZvDOAAvR4jSZHEjdB5UPTkAj0XmqoOqtCbvrqUFQTGxoBqgMIsj1AasNCwqBNRh0WzB69mI5ec8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96152+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16680152046966.536624582034392; Wed, 9 Nov 2022 09:33:24 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id IivAYY1788612x7e06FbyL3z; Wed, 09 Nov 2022 09:33:23 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.60.1668015203223395390 for ; Wed, 09 Nov 2022 09:33:23 -0800 X-Received: from localhost.localdomain (unknown [47.201.8.94]) by linux.microsoft.com (Postfix) with ESMTPSA id 20C4520C28B1; Wed, 9 Nov 2022 09:33:22 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 20C4520C28B1 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Erich McMillan , Liming Gao , Michael D Kinney , Michael Kubacki , Zhiguang Liu Subject: [edk2-devel] [PATCH v1 06/12] MdePkg: Fix conditionally uninitialized variables Date: Wed, 9 Nov 2022 12:32:40 -0500 Message-Id: <20221109173246.174-7-mikuback@linux.microsoft.com> In-Reply-To: <20221109173246.174-1-mikuback@linux.microsoft.com> References: <20221109173246.174-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: t7tDvpJWyXcl4dd1IDcCMunjx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1668015203; bh=QHenlw+dhoaJKAaz+lyd5yQl6PzGGvwuSrY4axyX8Io=; h=Cc:Date:From:Reply-To:Subject:To; b=m0BVTPdGF6Q3DAZlcz7nilglzsIJJsdB0lBwtvFjqRLBIgsxkTk3KiitcimOAy3Uqn/ 76c77OuGgIFeYRBbh4xmiBNyL46O06xhq7SUYygLv9zRxZUUQaKXqgO4D/XSwQixFtcxm 29ydbC0tk0rluBvBQ1jdu6MtNiBZQRUolf4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1668015206157100001 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki Fixes CodeQL alerts for CWE-457: https://cwe.mitre.org/data/definitions/457.html Cc: Erich McMillan Cc: Liming Gao Cc: Michael D Kinney Cc: Michael Kubacki Cc: Zhiguang Liu Co-authored-by: Erich McMillan Signed-off-by: Michael Kubacki --- MdePkg/Library/BaseLib/String.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/Strin= g.c index 98e6d31463e0..0ff0454b9d98 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -6,6 +6,7 @@ =20 **/ =20 +#include #include "BaseLibInternals.h" =20 /** @@ -408,7 +409,8 @@ StrDecimalToUintn ( { UINTN Result; =20 - StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result); + Result =3D !EFI_ERROR (StrDecimalToUintnS (String, (CHAR16 **)NULL, &Res= ult)) ? Result : MAX_UINTN; + return Result; } =20 @@ -454,7 +456,8 @@ StrDecimalToUint64 ( { UINT64 Result; =20 - StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result); + Result =3D !EFI_ERROR (StrDecimalToUint64S (String, (CHAR16 **)NULL, &Re= sult)) ? Result : MAX_UINT64; + return Result; } =20 @@ -501,7 +504,8 @@ StrHexToUintn ( { UINTN Result; =20 - StrHexToUintnS (String, (CHAR16 **)NULL, &Result); + Result =3D !EFI_ERROR (StrHexToUintnS (String, (CHAR16 **)NULL, &Result)= ) ? Result : MAX_UINTN; + return Result; } =20 @@ -548,7 +552,7 @@ StrHexToUint64 ( { UINT64 Result; =20 - StrHexToUint64S (String, (CHAR16 **)NULL, &Result); + Result =3D !EFI_ERROR (StrHexToUint64S (String, (CHAR16 **)NULL, &Result= )) ? Result : MAX_UINT64; return Result; } =20 @@ -989,7 +993,7 @@ AsciiStrDecimalToUintn ( { UINTN Result; =20 - AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result); + Result =3D !EFI_ERROR (AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, = &Result)) ? Result : MAX_UINTN; return Result; } =20 @@ -1031,7 +1035,7 @@ AsciiStrDecimalToUint64 ( { UINT64 Result; =20 - AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL, &Result); + Result =3D !EFI_ERROR (AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL,= &Result)) ? Result : MAX_UINT64; return Result; } =20 @@ -1077,7 +1081,7 @@ AsciiStrHexToUintn ( { UINTN Result; =20 - AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result); + Result =3D !EFI_ERROR (AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Res= ult)) ? Result : MAX_UINTN; return Result; } =20 @@ -1123,7 +1127,7 @@ AsciiStrHexToUint64 ( { UINT64 Result; =20 - AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Result); + Result =3D !EFI_ERROR (AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Re= sult)) ? Result : MAX_UINT64; return Result; } =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96152): https://edk2.groups.io/g/devel/message/96152 Mute This Topic: https://groups.io/mt/94918094/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-