mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Variable: add debug logs in VariableServiceSetVariable
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.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
a2c0496991
commit
a90c7df7ed
|
@ -3234,14 +3234,44 @@ VariableServiceSetVariable (
|
||||||
//
|
//
|
||||||
if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
|
if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
|
||||||
if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxAuthVariableSize - GetVariableHeaderSize ()) {
|
if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxAuthVariableSize - GetVariableHeaderSize ()) {
|
||||||
|
DEBUG ((DEBUG_ERROR,
|
||||||
|
"%a: Failed to set variable '%s' with Guid %g\n",
|
||||||
|
__FUNCTION__, VariableName, VendorGuid));
|
||||||
|
DEBUG ((DEBUG_ERROR,
|
||||||
|
"NameSize(0x%x) + PayloadSize(0x%x) > "
|
||||||
|
"MaxAuthVariableSize(0x%x) - HeaderSize(0x%x)\n",
|
||||||
|
StrSize (VariableName), PayloadSize,
|
||||||
|
mVariableModuleGlobal->MaxAuthVariableSize,
|
||||||
|
GetVariableHeaderSize ()
|
||||||
|
));
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
} else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0) {
|
} else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0) {
|
||||||
if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxVariableSize - GetVariableHeaderSize ()) {
|
if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxVariableSize - GetVariableHeaderSize ()) {
|
||||||
|
DEBUG ((DEBUG_ERROR,
|
||||||
|
"%a: Failed to set variable '%s' with Guid %g\n",
|
||||||
|
__FUNCTION__, VariableName, VendorGuid));
|
||||||
|
DEBUG ((DEBUG_ERROR,
|
||||||
|
"NameSize(0x%x) + PayloadSize(0x%x) > "
|
||||||
|
"MaxVariableSize(0x%x) - HeaderSize(0x%x)\n",
|
||||||
|
StrSize (VariableName), PayloadSize,
|
||||||
|
mVariableModuleGlobal->MaxVariableSize,
|
||||||
|
GetVariableHeaderSize ()
|
||||||
|
));
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxVolatileVariableSize - GetVariableHeaderSize ()) {
|
if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxVolatileVariableSize - GetVariableHeaderSize ()) {
|
||||||
|
DEBUG ((DEBUG_ERROR,
|
||||||
|
"%a: Failed to set variable '%s' with Guid %g\n",
|
||||||
|
__FUNCTION__, VariableName, VendorGuid));
|
||||||
|
DEBUG ((DEBUG_ERROR,
|
||||||
|
"NameSize(0x%x) + PayloadSize(0x%x) > "
|
||||||
|
"MaxVolatileVariableSize(0x%x) - HeaderSize(0x%x)\n",
|
||||||
|
StrSize (VariableName), PayloadSize,
|
||||||
|
mVariableModuleGlobal->MaxVolatileVariableSize,
|
||||||
|
GetVariableHeaderSize ()
|
||||||
|
));
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue