On 11/20/18 11:38, Vijayenthiran Subramaniam wrote:
> Print debug messages if size of the VariableName plus DataSize exceeds
> Max(Auth|Voltaile)VariableSize bytes. The messages will be useful if any
> platform specific value of Max(Auth|Voltaile)VariableSize PCDs have to
> be changed.
> 
> Cc: Star Zeng <star.z...@intel.com>
> Cc: Jian J Wang <jian.j.w...@intel.com>
> Cc: Ruiyu Ni <ruiyu...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subraman...@arm.com>
> ---
>  MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
> b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> index 8e8db71bd201..db54fa4412c0 100644
> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> @@ -3234,14 +3234,20 @@ VariableServiceSetVariable (
>      //
>      if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
>        if (StrSize (VariableName) + PayloadSize > 
> mVariableModuleGlobal->MaxAuthVariableSize - GetVariableHeaderSize ()) {
> +        DEBUG ((DEBUG_ERROR, "%a: Size of (%s) variable + DataSize exceeds 
> MaxAuthVariableSize.\n",
> +          __FUNCTION__, VariableName));
>          return EFI_INVALID_PARAMETER;
>        }
>      } else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0) {
>        if (StrSize (VariableName) + PayloadSize > 
> mVariableModuleGlobal->MaxVariableSize - GetVariableHeaderSize ()) {
> +        DEBUG ((DEBUG_ERROR, "%a: Size of (%s) variable + DataSize exceeds 
> MaxVariableSize.\n",
> +          __FUNCTION__, VariableName));
>          return EFI_INVALID_PARAMETER;
>        }
>      } else {
>        if (StrSize (VariableName) + PayloadSize > 
> mVariableModuleGlobal->MaxVolatileVariableSize - GetVariableHeaderSize ()) {
> +        DEBUG ((DEBUG_ERROR, "%a: Size of (%s) variable + DataSize exceeds 
> MaxVolatileVariableSize.\n",
> +          __FUNCTION__, VariableName));
>          return EFI_INVALID_PARAMETER;
>        }
>      }
> 

You could make this more useful as well -- again, *if* the package
maintainers agree with the new log messages --; namely, the vendor GUID,
DataSize, and the limit in question should / could all be logged.

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to