From nobody Tue Apr 30 12:34:22 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+39362+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+39362+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1555917891; cv=none; d=zoho.com; s=zohoarc; b=HEvVnnsK6zP2PjYSTjUy8XcFmoAHxH1NQR2EbLVvSxLZ8E79KdzCViin6oNy0tcYZKYvkUFEshmQgu4uaV0xyudAgw8FAGkFkT/1NEaK8rilOvsTzxY8EOs8bSUbqgclgNwH/e2m5KG3e2XxcVcel88kzYTYwrKYeaQU/B+3hyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555917891; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=j4gt68CYZD/m4QUC1XWkew/K8uP0YatxXh7MNSMV51c=; b=cAgiOWxdJWc48X3A5Fzb1WIFd0bXFKnssvgsS4BMgbiVQ5zJz/ehzn044Yst963EQAefLw1cSpgcaemv0pgjpEj+Zg7MEJwatWp/m/AioET+IuDxuMpicjJqvFLvUKaYRIKYqnd1W5Rcd3ufCtMftAbiAfmS4iJWltWQwVH5e+E= 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+39362+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 1555917891754672.2482845807435; Mon, 22 Apr 2019 00:24:51 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Mon, 22 Apr 2019 00:24:51 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2019 00:24:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,381,1549958400"; d="scan'208";a="225554173" X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by orsmga001.jf.intel.com with ESMTP; 22 Apr 2019 00:24:48 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: Hao Wu , Ard Biesheuvel , Michael D Kinney , Liming Gao , Jian J Wang Subject: [edk2-devel] [PATCH v1] MdeModulePkg/DxeCore: Please static checker for false report Date: Mon, 22 Apr 2019 15:24:47 +0800 Message-Id: <20190422072447.10548-1-hao.a.wu@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,hao.a.wu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1555917891; bh=Kqt6ZQlpfhqdLBc5XaFM3v49dipjl0F+KJfKLeWAqCQ=; h=Cc:Date:From:Reply-To:Subject:To; b=wPLKGC5ZPb/mcKizQg3QZ58S8U1j6cSbNvKVIirS14ppLgo7Q8bIuueVENAEUwIZMd8 hz6VDsnSjDAkYwC5xRqjeCvPm0fYY7lNwFu8XYN0sov+MkzA0sqFrVSJqt3dAd4leQ0ea dzqeueL1DPeZHOmgknA2+5vTDzkN4WtnmaM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" After commit 57df17fe26, some static check reports suspicous NULL pointer deference at line: Entry->MachineType =3D Entry->Emulator->MachineType; ^^^^^^^^^^^^^^^ within function PeCoffEmuProtocolNotify(). However, 'Entry->Emulator' is guaranteed to have a non-NULL value when previous call to the CoreHandleProtocol() returns EFI_SUCCESS. Thus, in order to please the static checker, this commit will add an ASSERT right before the false-positive NULL pointer dereference report. Cc: Ard Biesheuvel Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Signed-off-by: Hao Wu --- MdeModulePkg/Core/Dxe/Image/Image.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Im= age/Image.c index 08306a73fd..546fa96eee 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -166,6 +166,13 @@ PeCoffEmuProtocolNotify ( (VOID **)&Entry->Emulator ); ASSERT_EFI_ERROR (Status); + // + // When the above CoreHandleProtocol() call returns with EFI_SUCCESS, + // 'Entry->Emulator' is guaranteed to have a non-NULL value. + // The below ASSERT is for addressing a false positive NULL pointer + // dereference issue raised from static analysis. + // + ASSERT (Entry->Emulator !=3D NULL) =20 Entry->MachineType =3D Entry->Emulator->MachineType; =20 --=20 2.12.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 (#39362): https://edk2.groups.io/g/devel/message/39362 Mute This Topic: https://groups.io/mt/31271609/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-