From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mx.groups.io with SMTP id smtpd.web10.9336.1688725805050814119 for ; Fri, 07 Jul 2023 03:30:05 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=drILEiK8; spf=pass (domain: gmail.com, ip: 209.85.215.176, mailfrom: kuqin12@gmail.com) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-517bdc9e81dso646751a12.1 for ; Fri, 07 Jul 2023 03:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688725804; x=1691317804; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TUO5HgGpeTa9ZQ2vyPNk/HB/pLizSCNMHjhhBhLJw1g=; b=drILEiK8oVJlKRdS5CSoK9mpKU8d1OPJI1CuWvjRCivrcm9DQnXGeVIgrukQ99YaC5 LwoKVLR2Vq+krhI7KwPSwKpWxTRwsXvblKrA7E0WLl7wT+BG9QRMsq8xD5oV0AjB5+9L QZZm8yMn9JLFfYyPE84/ptKK4opBabVr4q4+2Eo81c0JamDOwGtUHeCADBkWyzlZG5BZ OxYXS3P5Kx5vQt51h0xG/IigyTanumgkzkv7fqa/KpDnr2qSMKCpOq8urFYrMkrbv4s3 LPnV+I4qpVTRhZOg1nSZd/rHy73wPbAX/HXy1J0A8fdujO1b9pxZnCrMQJVHj5Tom9BZ oHDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688725804; x=1691317804; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TUO5HgGpeTa9ZQ2vyPNk/HB/pLizSCNMHjhhBhLJw1g=; b=XgL9r44LUilDg7K4otjlyjkxHfij1+5essGBqOA/s0JLGG6p+ajj82NFXf7WCXr3qC OeChLbqvgHcJzS8WrbbFRkT+sj9cmGCpCTtS713JfRE/XuON+7RK8DyT1IRfYU4jUfZt +EFMB4fa7OujKsn9JRCnl7Qr4QYVv848XHTglpHTObdw/jZQivGSrrEKL7OByj8+ScFD tIUiwv+OWawkRcbitgf5bqi/p+QYnp2OMfKN8XyIJRwuj0NaJNkI3Nl4mYKpT3n0UWiY Mgw/Lnop7zVSGeiATZggPppf458fhpH+dB/So7BzCxu3nx1ayqIFVRCaPbFoJcyMSUFC zDpQ== X-Gm-Message-State: ABy/qLZq1qsSf+ld5QkNlMIuZHV1E3idcnzClydRNLDpOz36hn2IXYaw UB+mpDnhRduhHZPkq6a8j04o37uiFbo= X-Google-Smtp-Source: APBJJlFUlKDTYit0dhrYxAHlAKUsLzXNqm5/U/EJbozDHVc+G/AHdCUn9tPPD+yA+f0YdCchgJ9orQ== X-Received: by 2002:a05:6a20:7d94:b0:11e:f740:b988 with SMTP id v20-20020a056a207d9400b0011ef740b988mr4297314pzj.59.1688725804028; Fri, 07 Jul 2023 03:30:04 -0700 (PDT) Return-Path: Received: from ?IPV6:2001:4898:d8:33:3458:2b91:2cc3:27da? ([2001:4898:80e8:35:b445:2b91:2cc3:27da]) by smtp.gmail.com with ESMTPSA id k3-20020a170902e90300b001b8a697372dsm2931429pld.33.2023.07.07.03.30.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Jul 2023 03:30:03 -0700 (PDT) Message-ID: <7000f664-27df-e0cf-7242-7f4fd8eff4ef@gmail.com> Date: Fri, 7 Jul 2023 03:30:01 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [edk2-devel] [PATCH v2 1/1] SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator To: devel@edk2.groups.io, Sami Mujawar , Jiewen Yao , Jian J Wang Cc: Pierre Gondois References: <20230629235919.2077-1-kuqin12@gmail.com> <176D46B1D9752C4A.23465@groups.io> <176E7475C9A58A3E.7887@groups.io> From: "Kun Qin" In-Reply-To: <176E7475C9A58A3E.7887@groups.io> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Sami, Jiewen & Jian, Just a gentle ping on this. Could you please provide further feedback on this patch and/or merge the patch? Thanks in advance! Regards, Kun On 7/3/2023 1:09 PM, Kun Qin via groups.io 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 >> >> 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 >> 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; >> >> >>     // 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; >> >>     } >> > > > > >