From nobody Sat May 4 07:55:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47565+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47565+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568880496; cv=none; d=zoho.com; s=zohoarc; b=EowmcCLyM5ljOgpK1twtzu25uKDfL7Lbv5llDnC2L5aPYJlTbUhKzHsDI/NXvqdO++4t0UXaxaXAPvf6IP1wVUfuLxJ8gkH+DyPIL1Ss8eYk6XXrYfHgktSzYTy1fsabBg862Qp4WVymMaTpqcwRrQFZoU3yTcpJZVS9ybPmapc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568880496; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=cXRPIJKUIlRecBZdnzk8vFf3mVDWKNFHtvvpcCGwWiY=; b=C1jjYG4mZF07yH3AmnssUeh6p9Ftq3A1t5fZmEYfegsM6afd732lHaZxVAGTM02gbmsnWAFZXzZGIXux2Sb09hHZuDvtSn+Zg6QnDIAl6ulr6OcXw2gCIJlbErCYfeWqnKNtBVD78wZ7ppqpwMg+QoqC0aUD9kT4I4bLbneZBQU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47565+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568880496835672.4810619454893; Thu, 19 Sep 2019 01:08:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ib0bYY1788612xHhdiCh6JEf; Thu, 19 Sep 2019 01:08:16 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Thu, 19 Sep 2019 01:08:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 01:08:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,522,1559545200"; d="scan'208";a="191977960" X-Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 19 Sep 2019 01:08:13 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Michael Kubacki , Chasel Chiu , Nate DeSimone , Liming Gao Subject: [edk2-devel] [edk2-platforms PATCH v5] MinPlatformPkg/TestPointCheckLib: Add check for pointers Date: Thu, 19 Sep 2019 16:08:10 +0800 Message-Id: <20190919080810.50168-1-shenglei.zhang@intel.com> Precedence: Bulk List-Unsubscribe: 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,shenglei.zhang@intel.com X-Gm-Message-State: ug1IGKKgEjKzsJ6KgbVScu8wx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568880496; bh=3lxzk1mlDs/gANk0rPn1tdAIzJ4EuV8QNL2yiTXNhGM=; h=Cc:Date:From:Reply-To:Subject:To; b=KkVtTektRf4nFAsr1DPInluCVL/dijwu3qW14cqx0zOZ/GS4EXQmbivu3K4l2a9NZuW 3He/Vv/BT3IIuZn7XZf1YTSlXDIwvFysUCIzt83Vgp88DoyYUi9TbxvKfy18F7k5PIX1O y5F1CuKtHspdMw3jXG5bUSwd/BZTov+bufA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In DxeCheckBootVariable.c, add check for BootOrder and Variable that return EFI_NOT_FOUND when they are NULL. In DxeCheckGcd.c, add check for GcdIoMap to ensure it not NULL when allocating memory to what it points to. Cc: Michael Kubacki Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Shenglei Zhang --- v2: Update copyright v3: Fix the coding style. v4: Update the logic in DxeCheckBootVariable.c. We directly return when BootOrder/Variable =3D=3D NULL, in previous version= s. v5: Update the format of copyright and the coding style. .../Test/Library/TestPointCheckLib/DxeCheckBootVariable.c | 6 +++--- .../Test/Library/TestPointCheckLib/DxeCheckGcd.c | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckBootVariable.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPoin= tCheckLib/DxeCheckBootVariable.c index 85bd5b3d..5437cf6a 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= BootVariable.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= BootVariable.c @@ -1,6 +1,6 @@ /** @file =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -130,7 +130,7 @@ TestPointCheckLoadOptionVariable ( for (ListIndex =3D 0; ListIndex < sizeof(mLoadOptionVariableList)/sizeof= (mLoadOptionVariableList[0]); ListIndex++) { UnicodeSPrint (BootOrderName, sizeof(BootOrderName), L"%sOrder", mLoad= OptionVariableList[ListIndex]); Status =3D GetVariable2 (BootOrderName, &gEfiGlobalVariableGuid, (VOID= **)&BootOrder, &OrderSize); - if (EFI_ERROR(Status)) { + if (EFI_ERROR(Status) || (BootOrder =3D=3D NULL)) { continue; } for (Index =3D 0; Index < OrderSize/sizeof(CHAR16); Index++) { @@ -222,7 +222,7 @@ TestPointCheckKeyOptionVariable ( for (Index =3D 0; ; Index++) { UnicodeSPrint (KeyOptionName, sizeof(KeyOptionName), L"%s%04x", mKey= OptionVariableList[ListIndex], Index); Status =3D GetVariable2 (KeyOptionName, &gEfiGlobalVariableGuid, &Va= riable, &Size); - if (!EFI_ERROR(Status)) { + if (!EFI_ERROR(Status) && (Variable !=3D NULL)) { DumpKeyOption (KeyOptionName, Variable, Size); } else { break; diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckGcd.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib= /DxeCheckGcd.c index 82709d44..066121c7 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Gcd.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Gcd.c @@ -1,6 +1,6 @@ /** @file =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -241,11 +241,13 @@ TestPointDumpGcd ( } } if (GcdMemoryMap !=3D NULL) { - *GcdIoMap =3D AllocateCopyPool (NumberOfDescriptors * sizeof(EFI_GCD= _IO_SPACE_DESCRIPTOR), IoMap); + if (GcdIoMap !=3D NULL) { + *GcdIoMap =3D AllocateCopyPool (NumberOfDescriptors * sizeof(EFI_G= CD_IO_SPACE_DESCRIPTOR), IoMap); + } *GcdIoMapNumberOfDescriptors =3D NumberOfDescriptors; } } - =20 + if (DumpPrint) { DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointDumpGcd - Exit\n")); } --=20 2.18.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 (#47565): https://edk2.groups.io/g/devel/message/47565 Mute This Topic: https://groups.io/mt/34197426/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-