From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by mx.groups.io with SMTP id smtpd.web10.2047.1595018794511058281 for ; Fri, 17 Jul 2020 13:46:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=h68eg+9z; spf=pass (domain: nvidia.com, ip: 216.228.121.143, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 17 Jul 2020 13:44:37 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 17 Jul 2020 13:46:33 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 17 Jul 2020 13:46:33 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 17 Jul 2020 20:46:31 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.168) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 17 Jul 2020 20:46:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XSX8alvBWKUl8bQ46dyhuTYDjvn1tUHWgG4WfRfFJMN4xc/evQ1fvuovmISSaflcDVrpPQWX+/FozIN9pNeFGTiBHVYBcdPXtrPqzvXQsr2mAQMQ69uyDgfE+zLLXSmy37nAECERtS/2HZFFr+5G8AAMyzquaKZezp1ZiwET0RLMdzrESj7smUlS3AlMvU6Zz5+3mqeeceP4EcS7+YcYMtcbXtQxXxLtRh3AVFllIiRrLjH0r70iXjn+SiFxkEHCBRshXUz4lf3rvFAtGIZd6/dXUMUtz2+QFYjVqyadYkZ8HjUjVN6npeq0hEwkWRwMEPD2UGnDe0rd3eTzW6epCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DjawLJJCmuSdieTA+gafsjWD+hFxL9S5cI/qDWXBujw=; b=CaBLFLCH+/QaMInQ5VQLmR5cNynVgzWsirfLxC5h1zv0ksiXTc17Pr0TuWRZYAU9DggUSF5mdjoBAsGGYOpt7yFN9Lb2PL2Nt+/43Q1xi/DYnCL5kB1aGcppdRpP6WZhSo5Nz1fbwUeTcCt5LB9Um7BqSIF2nwf5zir8MK5gZq3aVxzJMu67gr9+WYZpY+rTeUgGL0MewCc7zFsPy1zMQmewuESe4cTWG4Iz76Q77D2j07aLb9dbcomZIeALhKWs54/H8rTN3FQ5zlkrazlHBcqO/lILYzFH9+51n1CYZnlVA3K3R1cfJp3tI00E0cONFpnxHcdw1QDeXzzXSgaAzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from DM6PR12MB3340.namprd12.prod.outlook.com (2603:10b6:5:3d::24) by DM5PR12MB1387.namprd12.prod.outlook.com (2603:10b6:3:6c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18; Fri, 17 Jul 2020 20:46:29 +0000 Received: from DM6PR12MB3340.namprd12.prod.outlook.com ([fe80::30b2:1a69:c256:d239]) by DM6PR12MB3340.namprd12.prod.outlook.com ([fe80::30b2:1a69:c256:d239%4]) with mapi id 15.20.3195.022; Fri, 17 Jul 2020 20:46:29 +0000 From: "Jeff Brasen" To: "Bi, Dandan" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Thread-Topic: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Thread-Index: AQHWSMHSd0ylGmCEHk+DcY+f6wAfMKjm/joAgCVm1/A= Date: Fri, 17 Jul 2020 20:46:29 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Enabled=True; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SiteId=43083d15-7273-40c1-b7db-39efd9ccc17a; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Owner=jbrasen@nvidia.com; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SetDate=2020-07-17T20:46:27.4413940Z; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Name=Unrestricted; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Application=Microsoft Azure Information Protection; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_ActionId=edcea4fe-3e98-44ca-84be-4981ef817c6d; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Extended_MSFT_Method=Automatic authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [216.228.112.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 60d55d53-a11e-4d5b-c82e-08d82a927b67 x-ms-traffictypediagnostic: DM5PR12MB1387: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fAcub4CJnmGYRj9HAeesNwMzyW1CfPzgt6vac+Dqv2a5FCtGS2FCF1SmR0HKFQntqb5tH9Yo0D1gcHpbwNYdSaP43jj2klIg3oq/I4GP1jvlpupbAK/FErV8ZTqDi7HDARgwp4fv+Syrt3NJ70KCD3/3sZx9Ad4JG5hTazy8+AgjQ8AYwOWUGGRbUpXESaQ6wN1gcOC/NR8XXf5gTj3QXMR283eXMDCSzN5gOM5BOsgG0IdYihh9pGgRhCguuy9XUsbYM3IN95ZVIHCSjNt+RUkjwbQfj1pFD4atCn0dV4TSco6d9b2uX2vBFS8CLBScBVtDR7uzbgZgHgknAumBdBBSXk/GTsU9H45MJJ1dWSCYhnZxQKrSGDbGdoqoTgmd x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3340.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(6029001)(4636009)(346002)(376002)(39860400002)(396003)(136003)(366004)(52536014)(478600001)(8676002)(55016002)(76116006)(9686003)(83380400001)(66946007)(66476007)(66556008)(64756008)(66446008)(8936002)(4326008)(110136005)(6506007)(2906002)(7696005)(53546011)(316002)(5660300002)(26005)(33656002)(71200400001)(186003)(86362001)(145603002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: OAeJOx3HOZCBA9Uk2o/Wl97h7db4LnDbvShy2ApLVii/jIpLDUOcYfzAgVA+lzNbasepmLLm2SlqjMwFaRPj0uoRiL67ORrok2xqbV0cJ2kajcLjPdIb1VFg36P5hO3xQOg/2B6gpH+ORPHYNR45IEcTJBiC106PCx7seIkduVhkJGnwCbylicuhVUce1bCBW2HUThmqq+nkdUqPu7R58ZQK/ZtTXafTPLw6SplmwkizfYtuddkC3c4AkbRIaIwaJoLwArKkRgbVvh/je6hOXyCkW7Ky7rGppBhDFPod2CX8l/rDddC1c4iZWi3FxcSB3xQh4hyT4dtGh69gJezonIxE3mzMpFvc4bIi4StJ00w7Ht/5b3F8HT8i+etk+rXf5yIJASWQOeKG6F21QWYU8yO9Fc7Z+Pe3JPM9vMymLaTPB9Sy1KV0AeRu4M8o8qlYWGlXXYGkVF2ZC2ch83fo2rKyoaw72t5kpk/rtMtCQNNvVTs91W9o+/Se4eLmYpYv x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3340.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60d55d53-a11e-4d5b-c82e-08d82a927b67 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jul 2020 20:46:29.5576 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: y5Aa/KdjEILINvpLFCvlmHmM22aHhdkBlFwq9qaZv4MriBdKxLWz1+nvi6br+ORYz6SdFFLek9ZuleHSxlFa6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1387 Return-Path: jbrasen@nvidia.com X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1595018677; bh=DjawLJJCmuSdieTA+gafsjWD+hFxL9S5cI/qDWXBujw=; h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature: ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To: Accept-Language:X-MS-Has-Attach:X-MS-TNEF-Correlator:msip_labels: authentication-results:x-originating-ip:x-ms-publictraffictype: x-ms-office365-filtering-correlation-id:x-ms-traffictypediagnostic: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:x-forefront-antispam-report: x-ms-exchange-antispam-messagedata:x-ms-exchange-transport-forked: MIME-Version:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg: Content-Language:Content-Type:Content-Transfer-Encoding; b=h68eg+9z5S9MfCeJyjoO4Fd5TurfRb/6BRQzg4yh3YoNNNr/ue8QPt44Gp1fxSwqo DuphCzd7VDAHsV36dB7XubjeKLO+J2MI5Hjeo9t+A/E9Pcj4v5VXTPNC0BvooF/Qmr dzIs6Epa3jCE2yVfQ34cM8Tw57HFQCdkKRi9mc7Kgco7VaDhcLWBl0BfWSEMPmEMmK orTvr5a/zLTLBEScs91e/floxBFH9/endkrKmQAKKspZQTUWCCVd4fjz4tqvTP+ULT mpjJsVhRIROU7DSsdoBAJ0obbC5GBCyplAAYApXxRToLyl5IDYTar6PYE8f+4yAyRK 0USugiC1QYZPQ== Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Do we need any additional review on this before it getting submitted? -Jeff -----Original Message----- From: Bi, Dandan =20 Sent: Tuesday, June 23, 2020 7:36 PM To: Jeff Brasen ; devel@edk2.groups.io Cc: Gao, Liming Subject: RE: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to Unico= deStrnToAsciiStrS External email: Use caution opening links or attachments Reviewed-by: Dandan Bi Thanks, Dandan > -----Original Message----- > From: Jeff Brasen > Sent: Tuesday, June 23, 2020 2:20 AM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Bi, Dandan=20 > ; Jeff Brasen > Subject: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to=20 > UnicodeStrnToAsciiStrS > > UnicodeStrToAsciiStrS requires that the source string is shorter than=20 > the destination buffer and will ASSERT if this is not true. Switch to=20 > UnicodeStrnToAsciiStrS as there are cases where the source string is=20 > longer than the buffer allocated for the device path. > > Signed-off-by: Jeff Brasen > --- > .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git > a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > index f500e20b32..d378c59dd9 100644 > --- > a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > +++ > b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > @@ -837,7 +837,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( > ControllerNameStringSize =3D FPDT_MAX_PERF_RECORD_SIZE -=20 > (*Length) - 1; > } > > - UnicodeStrToAsciiStrS(StringPtr, ComponentNameString, > ControllerNameStringSize); > + UnicodeStrnToAsciiStrS(StringPtr, ControllerNameStringSize - 1,=20 > + ComponentNameString, ControllerNameStringSize,=20 > + &ControllerNameStringSize); > > // > // Add a space in the end of the ControllerName @@ -879,7 +879,7=20 > @@ GetDeviceInfoFromHandleAndUpdateLength ( > AsciiStringPtr =3D ComponentNameString; > } > > - UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringS= ize); > + UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1,=20 > + AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize); > *Length +=3D (UINT8)DevicePathStringSize; > return EFI_SUCCESS; > } > -- > 2.17.1