public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Kun Qin <kuqin12@gmail.com>,
	devel@edk2.groups.io, Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	michael.d.kinney@intel.com, gaoliming@byosoft.com.cn,
	zhiguang.liu@intel.com
Cc: Pierre Gondois <pierre.gondois@arm.com>, "nd@arm.com" <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v2 1/1] SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator
Date: Fri, 7 Jul 2023 09:16:25 +0100	[thread overview]
Message-ID: <e5aad8a1-1ed8-8e65-4376-edeb904c663d@arm.com> (raw)
In-Reply-To: <208c571d-a05e-e3c7-b94d-9e9b25f27f0c@gmail.com>

Hi Kun,

This patch and Pierre's series at 
https://edk2.groups.io/g/devel/message/106711 are both required to fix 
the RNG implementation for Arm.

I will wait for the MdePkg and SecurityPkg maintainers for any feedback 
by end of next week. If there are no futher comments, I will merge both 
this patch and the series at https://edk2.groups.io/g/devel/message/106711.

Regards,

Sami Mujawar

On 03/07/2023 09:09 pm, Kun Qin wrote:
> Hi Sami,
>
> Would you prefer to have input from Jiewen or Jian to review this 
> patch as well?
>
> Otherwise, would you mind helping me to merge the change?
>
> Thanks in advance!
>
> Regards,
> Kun
>
> On 6/29/2023 4:59 PM, Kun Qin via groups.io wrote:
>> From: Kun Qin <kuqin@microsoft.com>
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4491
>>
>> 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 <jiewen.yao@intel.com>
>> Cc: Jian J Wang <jian.j.wang@intel.com>
>> Cc: Sami Mujawar <Sami.Mujawar@arm.com>
>> Cc: Pierre Gondois <pierre.gondois@arm.com>
>>
>> Signed-off-by: Kun Qin <kuqin@microsoft.com>
>> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
>> ---
>>
>> 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;
>>
>>
>>     // Rng algorithms 2 times, one for the allocation, one to populate.
>>
>> -  mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX);
>>
>> +  mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * 
>> sizeof (EFI_RNG_ALGORITHM));
>>
>>     if (mAvailableAlgoArray == NULL) {
>>
>>       return EFI_OUT_OF_RESOURCES;
>>
>>     }
>>
>> diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c 
>> b/SecurityPkg/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;
>>
>>
>>     // Rng algorithms 2 times, one for the allocation, one to populate.
>>
>> -  mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX);
>>
>> +  mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * 
>> sizeof (EFI_RNG_ALGORITHM));
>>
>>     if (mAvailableAlgoArray == NULL) {
>>
>>       return EFI_OUT_OF_RESOURCES;
>>
>>     }
>>

  reply	other threads:[~2023-07-07  8:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 23:59 [PATCH v2 0/1] Fixing RngDxe error for ARM/AARCH64 Kun Qin
2023-06-29 23:59 ` [PATCH v2 1/1] SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator Kun Qin
2023-07-07  8:21   ` [edk2-devel] " Sami Mujawar
2023-06-30  3:12 ` [edk2-devel] Does RedfishPkg support BMC Chip's lan over usb feature? Yoshinoya
2023-06-30  3:38   ` Chang, Abner
2023-10-19  1:51   ` [edk2-devel] Question about OvmfPackage cxl emulation support Yoshinoya
2023-10-19 11:58     ` Laszlo Ersek
2023-10-21  3:50       ` Yoshinoya
2023-10-24  6:48         ` Yoshinoya
2023-10-24  8:05           ` Gerd Hoffmann
2023-10-25  5:58             ` Yoshinoya
     [not found] ` <176D46B1D9752C4A.23465@groups.io>
2023-07-03 20:09   ` [edk2-devel] [PATCH v2 1/1] SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator Kun Qin
2023-07-07  8:16     ` Sami Mujawar [this message]
     [not found]   ` <176E7475C9A58A3E.7887@groups.io>
2023-07-07 10:30     ` Kun Qin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5aad8a1-1ed8-8e65-4376-edeb904c663d@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox