From nobody Mon May 6 13:23:00 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+46672+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+46672+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1567427700; cv=none; d=zoho.com; s=zohoarc; b=M939K+N6p/n+ZXr6iuikjmmd7kL4scoIT85tTRWp9fkc+wGc1ZhBFcY/48uYxlsVW4+f4urotJfTrpfEoRJqhUn/8/okld112/5D6Kko81gz6V6fJ2zuOCnXW3oPpI6kdlMnFHbK6+RPJM5I2YO4FRbZmSz1N+OZCEIiJTA3uVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567427700; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=fCNqPTPaQGBkcNtWjPyNUM/gezcbHh5X6Xt1ilyMW44=; b=jsMfPNdoOl8fNgMM6mcYG8Gm49U+vAuTrRflXXuc+/f37Y/hp6wrtP1vYwsN+AWFo94yOxj0fphzX8Fm62Dp44WjxwjcsewPg8EAFzZevscU+eAC0xmt58AdA91MqRlt4fVeb9NmgQxVqjYxSxkuP13VOLpJDHJSAqF7FJiAEe8= 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+46672+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 1567427699941847.3637649254968; Mon, 2 Sep 2019 05:34:59 -0700 (PDT) Return-Path: X-Received: from mga06.intel.com (mga06.intel.com []) by groups.io with SMTP; Mon, 02 Sep 2019 05:34:59 -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 orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Sep 2019 05:34:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,459,1559545200"; d="scan'208";a="186990352" X-Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 02 Sep 2019 05:34:57 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Michael Kubacki , Chasel Chiu , Nate DeSimone , Liming Gao Subject: [edk2-devel] [PATCH] MinPlatformPkg/TestPointCheckLib: Add check for pointers Date: Mon, 2 Sep 2019 20:34:51 +0800 Message-Id: <20190902123452.27716-3-shenglei.zhang@intel.com> In-Reply-To: <20190902123452.27716-1-shenglei.zhang@intel.com> References: <20190902123452.27716-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1567427699; bh=/tgv2Ebjv7loUoKf9Kt58KAJ1BlobzKYtCUKWjnuKD8=; h=Cc:Date:From:Reply-To:Subject:To; b=oOQCqR+9Ns7KnLWSPu67oNVpTrt9VD7ykRdFwFonbdBQ9561ziP5c3jVnXte8WzSbKW yoUSuz2ccIM9E57TUWWFfKyIJfCOWl4PyEEM0lcxccMlvcVvDvnfsgYsUh9noR0skOt7E +3bpnssEhAc2KU/nOEg4qV82Ib3rF/6AI28= 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 --- .../Test/Library/TestPointCheckLib/DxeCheckBootVariable.c | 6 ++++++ .../Test/Library/TestPointCheckLib/DxeCheckGcd.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckBootVariable.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPoin= tCheckLib/DxeCheckBootVariable.c index 85bd5b3d..a9af33a3 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= BootVariable.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= BootVariable.c @@ -130,6 +130,9 @@ 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(BootOrder =3D=3D NULL) { + return EFI_NOT_FOUND;; + } if (EFI_ERROR(Status)) { continue; } @@ -222,6 +225,9 @@ 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(Variable =3D=3D NULL) { + return EFI_NOT_FOUND;; + }=20 if (!EFI_ERROR(Status)) { DumpKeyOption (KeyOptionName, Variable, Size); } else { diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckGcd.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib= /DxeCheckGcd.c index 82709d44..989606b6 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Gcd.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Gcd.c @@ -241,7 +241,9 @@ 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 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 (#46672): https://edk2.groups.io/g/devel/message/46672 Mute This Topic: https://groups.io/mt/33110621/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-