mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
Remove local function IsValidDevicePath and use new interface provided by UefiDevicePathlib.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Eric Dong<eric.dong@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13742 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c352b29843
commit
98b241d634
@ -274,56 +274,6 @@ BdsBootDeviceSelect (
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Validate the device path instance.
|
|
||||||
|
|
||||||
Only base on the length filed in the device path node to validate the device path.
|
|
||||||
|
|
||||||
@param DevicePath A pointer to a device path data structure.
|
|
||||||
@param MaxSize Max valid device path size. If big than this size,
|
|
||||||
return error.
|
|
||||||
|
|
||||||
@retval TRUE An valid device path.
|
|
||||||
@retval FALSE An invalid device path.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
IsValidDevicePath (
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
|
||||||
IN UINTN MaxSize
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UINTN Size;
|
|
||||||
UINTN NodeSize;
|
|
||||||
|
|
||||||
if (DevicePath == NULL) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Size = 0;
|
|
||||||
|
|
||||||
while (!IsDevicePathEnd (DevicePath)) {
|
|
||||||
NodeSize = DevicePathNodeLength (DevicePath);
|
|
||||||
if (NodeSize < END_DEVICE_PATH_LENGTH) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Size += NodeSize;
|
|
||||||
if (Size > MaxSize) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DevicePath = NextDevicePathNode (DevicePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
Size += DevicePathNodeLength (DevicePath);
|
|
||||||
if (Size > MaxSize) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Validate input console variable data.
|
Validate input console variable data.
|
||||||
@ -347,7 +297,7 @@ BdsFormalizeConsoleVariable (
|
|||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
&VariableSize
|
&VariableSize
|
||||||
);
|
);
|
||||||
if (!IsValidDevicePath (DevicePath, VariableSize)) {
|
if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) {
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user