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:
niruiyu 2012-09-26 09:01:23 +00:00
parent c352b29843
commit 98b241d634
1 changed files with 1 additions and 51 deletions

View File

@ -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.
@ -347,7 +297,7 @@ BdsFormalizeConsoleVariable (
&gEfiGlobalVariableGuid,
&VariableSize
);
if (!IsValidDevicePath (DevicePath, VariableSize)) {
if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) {
Status = gRT->SetVariable (
VariableName,
&gEfiGlobalVariableGuid,