[edk2-devel] [PATCH v1 1/1] MdeModulePkg: Initialize temp variable in VarCheckPolicyLib

Wu, Hao A hao.a.wu at intel.com
Mon Apr 12 02:23:40 UTC 2021


> -----Original Message-----
> From: Bret Barkelew <bret at corthon.com>
> Sent: Saturday, April 10, 2021 2:25 AM
> To: devel at edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>
> Subject: [PATCH v1 1/1] MdeModulePkg: Initialize temp variable in
> VarCheckPolicyLib
> 
> DumpVariablePolicy() will return EFI_INVALID_PARAMETER if the Buffer
> pointer is NULL and the indirect Size is anything but 0. Since this TempSize
> was not being initialized it is very likely that this sequence would not return
> the total buffer size as expected.
> 
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3310
> 
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Signed-off-by: Bret Barkelew <bret.barkelew at microsoft.com>
> ---
>  MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
> b/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
> index 14e1904e96d3..e50edb4ffc5a 100644
> --- a/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
> +++ b/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
> @@ -216,6 +216,7 @@ VarCheckPolicyLibMmiHandler (
>          DumpParamsOut->TotalSize = 0;
>          DumpParamsOut->PageSize = 0;
>          DumpParamsOut->HasMore = FALSE;
> +        TempSize = 0;
>          SubCommandStatus = DumpVariablePolicy (NULL, &TempSize);


Reviewed-by: Hao A Wu <hao.a.wu at intel.com>

Best Regards,
Hao Wu


>          if (SubCommandStatus == EFI_BUFFER_TOO_SMALL && TempSize > 0) {
>            mCurrentPaginationCommand =
> VAR_CHECK_POLICY_COMMAND_DUMP;
> --
> 2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73931): https://edk2.groups.io/g/devel/message/73931
Mute This Topic: https://groups.io/mt/81976395/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list