From nobody Mon Feb 9 07:56:21 2026 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+106547+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+106547+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1688083166; cv=none; d=zohomail.com; s=zohoarc; b=C806z0txMdfE3cri5EnYh6GM32Xk1KUJ3/+2f9lAwrLpqjyyOq1vjcMXeWjBuLTDm83+AbrLpy1uV5mbz0X9ZcdwTWj30tQTOlTdpl++8dFlU+s870aYvnXUW6tlc05x7OspH1iGJd36BpFK3uC0cKvNNodikN/vSOurO9YJPn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688083166; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=mj5d+Bj7PCdoYvTQ2avf6f0XYt2JPaLC5fQ4MRmJDvQ=; b=emmELGxJMhN3t/jHOQZmW0f/bM4BJoUsPh+4Zn2Cpo22X8M3f2gMQ+WwRNtBy83m06UHIlWHZJjTLe4H58WY+QwOOdFOV3B1Ghm5DBmeycwd1IB1JE6smhwf0RtKwKNGamZx9IdascT+fwMoIJHvOjtwmMZAY0Rb1igt4KTS6DQ= 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+106547+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1688083166088730.5562969818417; Thu, 29 Jun 2023 16:59:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lUb7YY1788612xkrYRwRVvBO; Thu, 29 Jun 2023 16:59:25 -0700 X-Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mx.groups.io with SMTP id smtpd.web10.1365.1688083164862426355 for ; Thu, 29 Jun 2023 16:59:24 -0700 X-Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1b80b343178so8916825ad.0 for ; Thu, 29 Jun 2023 16:59:24 -0700 (PDT) X-Gm-Message-State: h2mgzmbTriavVZFIURAbjEv0x1787277AA= X-Google-Smtp-Source: APBJJlHLhJRrJlFyHuMk5cYDI7+hsgB5M9gEzuMw5devG0UyoNJosmOTZ0xHcn8RkNYhXf5ZUNFdMQ== X-Received: by 2002:a17:902:da92:b0:1b7:e646:4cc4 with SMTP id j18-20020a170902da9200b001b7e6464cc4mr635315plx.28.1688083164037; Thu, 29 Jun 2023 16:59:24 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:7:8971:7e07:c1c3:d47a]) by smtp.gmail.com with ESMTPSA id y8-20020a1709029b8800b001b23eb0b4bbsm9617476plp.147.2023.06.29.16.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 16:59:23 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Sami Mujawar , Pierre Gondois , Sami Mujawar Subject: [edk2-devel] [PATCH v2 1/1] SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator Date: Thu, 29 Jun 2023 16:59:18 -0700 Message-ID: <20230629235919.2077-2-kuqin12@gmail.com> In-Reply-To: <20230629235919.2077-1-kuqin12@gmail.com> References: <20230629235919.2077-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,kuqin12@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1688083165; bh=OYS17VT3tprruokg6BL95KF1JaRjmpE/GCE62pe7LtY=; h=Cc:Date:From:Reply-To:Subject:To; b=tKLZseLXKEXgE50mbh3HVdbnOblt0yPmBx2VxSwXMWBjUYIqCgZGspBbjGNxoS/PCvV b4fUuU60VLVQG1TvJsPPPwuHI9CtDufOzM/5G+FzTve0AzvLGvTafiK+Yvpn5XJu06vyD vwlhUbqbS7IGiOpulr3vxjeECci6dr3HVi8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1688083167221100002 Content-Type: text/plain; charset="utf-8" From: Kun Qin REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4491 mAvailableAlgoArray is currently allocated for "RNG_AVAILABLE_ALGO_MAX" number of bytes, whereas it was dereferenced as "EFI_RNG_ALGORITHM". This change fixed the buffer allocation logic by allocating a proper size of buffer before referencing. Cc: Jiewen Yao Cc: Jian J Wang Cc: Sami Mujawar Cc: Pierre Gondois Signed-off-by: Kun Qin Reviewed-by: Sami Mujawar --- Notes: v2: - Added reviewed-by tag [Sami] SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c | 2 +- SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c= b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c index e8be217f8a8c..e7107a0b7039 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c @@ -33,7 +33,7 @@ GetAvailableAlgorithms ( UINT16 MinorRevision; =20 // Rng algorithms 2 times, one for the allocation, one to populate. - mAvailableAlgoArray =3D AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX); + mAvailableAlgoArray =3D AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * sizeo= f (EFI_RNG_ALGORITHM)); if (mAvailableAlgoArray =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c b/Secur= ityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c index 4b24f5c4a69b..5e621df601fb 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c @@ -32,7 +32,7 @@ GetAvailableAlgorithms ( UINT16 MinorRevision; =20 // Rng algorithms 2 times, one for the allocation, one to populate. - mAvailableAlgoArray =3D AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX); + mAvailableAlgoArray =3D AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * sizeo= f (EFI_RNG_ALGORITHM)); if (mAvailableAlgoArray =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } --=20 2.41.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 (#106547): https://edk2.groups.io/g/devel/message/106547 Mute This Topic: https://groups.io/mt/99863881/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-