From nobody Fri May 3 09:26:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70614+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70614+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1611221997; cv=none; d=zohomail.com; s=zohoarc; b=OUR4UkN0dqoJgcEyldNV2ADxMfIDMAdQ4oid6v0RJLKMiyogoXZdaTbek0AHDgEmc7OvC72tqKmp5OYWfJp6L3b+HS0lYVoXTuwMHP7susTyL+YI3LYpfGITQlxSwQuj3r3cMtC/yKskW7B9D6Z9WSWKSyRcntNP1fvoN5H046w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611221997; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=SgZLtVx41ZQO832eRkolfIhvi1YY/BQInnfmY7I41/c=; b=mOj0u1DDxed1PPaYPrABLYUV0grlvsMWb2SvbNSTt8llfc9QsuUd+h5c74EiPSl4FyZZmg4QmD9ptaZTjULIitd5wPcxnPSJ4hvfHNdEcwoHLlsQA5wbpUK4UmiTHNCnb82RN9xkOhu6Ccx15+tOCQRDIDGI5eHN+nZ4ODs0bYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70614+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1611221997431242.4774140724794; Thu, 21 Jan 2021 01:39:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6FlZYY1788612xQkNhbG4okR; Thu, 21 Jan 2021 01:39:55 -0800 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.4892.1611221989595886776 for ; Thu, 21 Jan 2021 01:39:49 -0800 IronPort-SDR: DUzSVkCLV8FpkoAibsGgFsXBhnIz8ChRNldxvMSrZo2K2JXofW7zBs7vUTrSDhp9YyJaYqdkHV rkObEQPbNBgw== X-IronPort-AV: E=McAfee;i="6000,8403,9870"; a="175736833" X-IronPort-AV: E=Sophos;i="5.79,363,1602572400"; d="scan'208";a="175736833" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2021 01:39:49 -0800 IronPort-SDR: czRdS1iBP7CuZ7x8jFZxJDHkbxe50sGl13tksBNZgAA8Lwa9pVAlLRWhm6qIx/1V0Y/rmL0KAD jKOGZ0wEhByQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,363,1602572400"; d="scan'208";a="385235569" X-Received: from shwdeopenlab103.ccr.corp.intel.com ([10.239.183.148]) by orsmga008.jf.intel.com with ESMTP; 21 Jan 2021 01:39:47 -0800 From: "Zeng, Star" To: devel@edk2.groups.io Cc: Star Zeng , Eric Dong , Ray Ni , Laszlo Ersek Subject: [edk2-devel] [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: NumberOfCpus may be uninitialized Date: Thu, 21 Jan 2021 17:39:44 +0800 Message-Id: <20210121093944.1621-1-star.zeng@intel.com> MIME-Version: 1.0 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,star.zeng@intel.com X-Gm-Message-State: UJrgUDbEsDXCU4h9W735ZYm6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1611221995; bh=1h0IGdbfoYVqUhuVHceEFeSY8NpU5V1f8+f+Lx7bwZ4=; h=Cc:Date:From:Reply-To:Subject:To; b=opfmkyv1SD9e8g5EpDRUdf7DZtxX1Sb2ebbrXtxCiPnQvFruBwOS0KVuyCjMiuFNl4o dzFopWguHj0PFe7B2Z1paL3IKqxcCXP014CcYaiigfDuxGaBNV734hgSJxBqf7nJ2OCJt tScu+ZeVR0kfP71Z958AcaRd4OJs/m4BLuQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" NumberOfCpus local variable in GetAcpiCpuData will be uninitialized when CpuS3DataDxe runs before DxeRegisterCpuFeaturesLib (linked by CpuFeaturesDxe) because there is no code to initialize it at (AcpiCpuData !=3D NULL) execution path. The issue is exposed after cefad282fb31aff3e1a6dcbd368cbbffc3fce900 and 38ee7bafa72f58982f99ac6f61eef160f80bad69. There was negligence in that code review. One further topic may be "Could EDK2 CI be enhanced to catch this kind of uninitialized local variable case?". :) This patch fixes this regression issue. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Star Zeng Reviewed-by: Laszlo Ersek --- .../Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesL= ib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 7bb92404027f..60daa5cc87f0 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -957,6 +957,7 @@ GetAcpiCpuData ( // // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable= for all CPUs // + NumberOfCpus =3D AcpiCpuData->NumberOfCpus; TableSize =3D 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE); RegisterTable =3D AllocatePages (EFI_SIZE_TO_PAGES (TableSize)); ASSERT (RegisterTable !=3D NULL); --=20 2.27.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 (#70614): https://edk2.groups.io/g/devel/message/70614 Mute This Topic: https://groups.io/mt/80000246/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-