From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web11.29500.1683356134472044513 for ; Fri, 05 May 2023 23:55:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=BU/9pWTe; spf=pass (domain: byosoft.com.cn, ip: 114.80.218.36, mailfrom: gaoliming@byosoft.com.cn) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 6FBAAA32DFF8 for ; Sat, 6 May 2023 14:55:30 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1683356130; bh=xvD2vnRPT4DSP/foldJ1xJlp5wNJnoxaT2EG4F4uHW0=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=BU/9pWTemS59uvPLkxv4JpM6GqEtcTfTJdhSDuxfy7ofTJjUDybz7fvKB/FemznLh kBdb4oZzNr2CbmFlh39ftk0I8cRNqVBEe4j86ZeiDSf+rYfYnyQq/Va3kCxfWnO6w3 TzO8QO6AgsA+FJN7jAP9+cDVCE++8IyIzJESBifY= Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 5304FA32DFDE for ; Sat, 6 May 2023 14:55:30 +0800 (CST) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id E5AEAA32DFFC for ; Sat, 6 May 2023 14:55:29 +0800 (CST) Authentication-Results: zrleap.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id 72800A32E005 for ; Sat, 6 May 2023 14:55:25 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Sat, 06 May 2023 14:55:17 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Giri Mudusuru'" Cc: "'Michael D Kinney'" , "'Zhiguang Liu'" , "'Andrew Fish'" References: <5317cb10a883b1082d5b53825871cf5220181c50.1682707884.git.girim@apple.com> <175BE1BE3E9B8CC1.28444@groups.io> In-Reply-To: <175BE1BE3E9B8CC1.28444@groups.io> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0g5Zue5aSNOiBbUEFUQ0ggMi8yXSBTaGVsbFBrZy9VZWZpU2hlbGxEZWJ1ZzFDb21tYW5kc0xpYjogUmVwbGFjZSBoYXJkY29kZWQgU01CSU9TIHN0cmluZ3Mu?= Date: Sat, 6 May 2023 14:55:18 +0800 Message-ID: <026601d97fe7$b7da72e0$278f58a0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQDk6eWjAYDy3P2bWb7scTAWQIN5cwFGk4B+AlDlIZexGT+LUA== Sender: "gaoliming" Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Giri: I create PR https://github.com/tianocore/edk2/pull/4350 to merge this patch. But, Open CI reports the below issue. Please help fix them.=20 ERROR -=20 ERROR - EFI coding style error ERROR - *Error code: 9004 ERROR - *For comment line with '///< ... text ...' format, if it is used, i= t should be after the code section ERROR - *file: //__w/1/s/Build/.pytool/Plugin/EccCheck/ShellPkg/Library/UefiShellDebug1Com= m andsLib/SmbiosView/PrintInfo.c ERROR - *Line number: 139 ERROR - * ERROR -=20 ERROR - EFI coding style error ERROR - *Error code: 9004 ERROR - *For comment line with '///< ... text ...' format, if it is used, i= t should be after the code section ERROR - *file: //__w/1/s/Build/.pytool/Plugin/EccCheck/ShellPkg/Library/UefiShellDebug1Com= m andsLib/SmbiosView/PrintInfo.c ERROR - *Line number: 224 ERROR - * Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED gaoliming via > groups.io > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA5=D4=C24=C8=D5 15:57 > =CA=D5=BC=FE=C8=CB: 'Giri Mudusuru' ; devel@edk2.groups.= io > =B3=AD=CB=CD: 'Michael D Kinney' ; 'Zhiguang = Liu' > ; 'Andrew Fish' > =D6=F7=CC=E2: [edk2-devel] =BB=D8=B8=B4: [PATCH 2/2] > ShellPkg/UefiShellDebug1CommandsLib: Replace hardcoded SMBIOS strings. >=20 > Reviewed-by: Liming Gao >=20 > > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > > =B7=A2=BC=FE=C8=CB: Giri Mudusuru > > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA4=D4=C229=C8=D5 2:53 > > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > > =B3=AD=CB=CD: Giri Mudusuru ; Michael D Kinney > > ; Liming Gao ; > > Zhiguang Liu ; Andrew Fish > > =D6=F7=CC=E2: [PATCH 2/2] ShellPkg/UefiShellDebug1CommandsLib: Replace > > hardcoded SMBIOS strings. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3805 > > > > Replace hardcoded SMBIOS Anchor string and size with defines. > > > > Fix buffer overflow as described below. > > > > Smbios64BitPrintEPSInfo () is coded like: > > UINT8 Anchor[5]; > > > > MemToString (Anchor, SmbiosTable->AnchorString, 5); > > > > But the definition of MemToString() > > Copy Length of Src buffer to Dest buffer, > > add a NULL termination to Dest buffer. > > > > So Anchor needs to be +1 the size of the SMBIOS Anchor string `_SM3_`. > > > > Cc: Michael D Kinney > > Cc: Liming Gao > > Cc: Zhiguang Liu > > Cc: Andrew Fish > > Signed-off-by: Giri Mudusuru > > --- > > .../UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c | 9 > +++++---- > > .../UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c | 9 > > +++++---- > > 2 files changed, 10 insertions(+), 8 deletions(-) > > > > diff --git > > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > > index 1811cf0c44..dd190b006f 100644 > > --- > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > > +++ > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c > > @@ -5,6 +5,7 @@ > > Copyright (c) 1985 - 2022, American Megatrends International LLC. > > > > (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> > > > (C) Copyright 2015-2019 Hewlett Packard Enterprise Development > > LP
> > > > + Copyright (c) 2023 Apple Inc. All rights reserved.
> > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > > > **/ > > > > @@ -135,7 +136,7 @@ SmbiosPrintEPSInfo ( > > IN UINT8 Option > > > > ) > > > > { > > > > - UINT8 Anchor[5]; > > > > + UINT8 Anchor[SMBIOS_ANCHOR_STRING_LENGTH + 1]; ///< > Including > > terminating NULL character > > > > UINT8 InAnchor[6]; > > > > > > > > if (SmbiosTable =3D=3D NULL) { > > > > @@ -149,7 +150,7 @@ SmbiosPrintEPSInfo ( > > > > > > if (Option >=3D SHOW_NORMAL) { > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), > > gShellDebug1HiiHandle); > > > > - MemToString (Anchor, SmbiosTable->AnchorString, 4); > > > > + MemToString (Anchor, SmbiosTable->AnchorString, > > SMBIOS_ANCHOR_STRING_LENGTH); > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, > > Anchor); > > > > ShellPrintHiiEx ( > > > > -1, > > > > @@ -220,7 +221,7 @@ Smbios64BitPrintEPSInfo ( > > IN UINT8 Option > > > > ) > > > > { > > > > - UINT8 Anchor[5]; > > > > + UINT8 Anchor[SMBIOS_3_0_ANCHOR_STRING_LENGTH + 1]; ///< > > Including terminating NULL character > > > > > > > > if (SmbiosTable =3D=3D NULL) { > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), > > gShellDebug1HiiHandle); > > > > @@ -234,7 +235,7 @@ Smbios64BitPrintEPSInfo ( > > if (Option >=3D SHOW_NORMAL) { > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_PRINTINFO_64_BIT_ENTRY_POINT_SIGN), > > gShellDebug1HiiHandle); > > > > > > > > - MemToString (Anchor, SmbiosTable->AnchorString, 5); > > > > + MemToString (Anchor, SmbiosTable->AnchorString, > > SMBIOS_3_0_ANCHOR_STRING_LENGTH); > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, > > Anchor); > > > > > > > > ShellPrintHiiEx ( > > > > diff --git > > > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c > > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c > > index e9360beb23..7e7eef3fd8 100644 > > --- > > > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c > > +++ > > > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c > > @@ -3,6 +3,7 @@ > > > > > > (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> > > > Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
> > > > + Copyright (c) 2023 Apple Inc. All rights reserved.
> > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > > > **/ > > > > @@ -263,7 +264,7 @@ SMBiosView ( > > return EFI_BAD_BUFFER_SIZE; > > > > } > > > > > > > > - if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) =3D=3D 0) { > > > > + if (CompareMem (SMBiosTable->AnchorString, > SMBIOS_ANCHOR_STRING, > > SMBIOS_ANCHOR_STRING_LENGTH) =3D=3D 0) { > > > > // > > > > // Have got SMBIOS table > > > > // > > > > @@ -441,7 +442,7 @@ SMBios64View ( > > return EFI_BAD_BUFFER_SIZE; > > > > } > > > > > > > > - if (CompareMem (SMBiosTable->AnchorString, "_SM3_", 5) =3D=3D 0) { > > > > + if (CompareMem (SMBiosTable->AnchorString, > > SMBIOS_3_0_ANCHOR_STRING, SMBIOS_3_0_ANCHOR_STRING_LENGTH) > > =3D=3D 0) { > > > > // > > > > // Have got SMBIOS table > > > > // > > > > @@ -612,7 +613,7 @@ InitSmbiosTableStatistics ( > > return EFI_NOT_FOUND; > > > > } > > > > > > > > - if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) !=3D 0) { > > > > + if (CompareMem (SMBiosTable->AnchorString, > SMBIOS_ANCHOR_STRING, > > SMBIOS_ANCHOR_STRING_LENGTH) !=3D 0) { > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), > gShellDebug1HiiHandle); > > > > return EFI_INVALID_PARAMETER; > > > > } > > > > @@ -753,7 +754,7 @@ InitSmbios64BitTableStatistics ( > > return EFI_NOT_FOUND; > > > > } > > > > > > > > - if (CompareMem (SMBiosTable->AnchorString, "_SM3_", 5) !=3D 0) { > > > > + if (CompareMem (SMBiosTable->AnchorString, > > SMBIOS_3_0_ANCHOR_STRING, > > SMBIOS_3_0_ANCHOR_STRING_LENGTH) !=3D 0) { > > > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), > gShellDebug1HiiHandle); > > > > return EFI_INVALID_PARAMETER; > > > > } > > > > -- > > 2.39.2 (Apple Git-144) >=20 >=20 >=20 >=20 >=20 >=20 >=20