Revision: 19409
http://sourceforge.net/p/edk2/code/19409
Author: vanjeff
Date: 2015-12-18 07:39:35 +0000 (Fri, 18 Dec 2015)
Log Message:
-----------
ShellPkg/Shell - Fix ASSERT() when FvSimpleFileSystemDxe is used
When the FvSimpleFileSystemDxe module is included in a platform,
Simple File System Protocols are produced for firmware volumes(FV)
that do not have the same style device paths as file systems with
file names. The ShellPkg has an assumption that the device path
contains device path nodes of type MEDIA_FILEPATH_DP and generates
an ASSERT() if any other device path nodes are encountered. This
change removes the ASSERT() condition and instead returns NULL that
means EfiShellGetFilePathFromDevicePath() can not convert the
device path nodes that represent the file path to a Unicode string.
(Sync patch r19228 from main trunk.)
Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/19228
Modified Paths:
--------------
branches/UDK2015/ShellPkg/Application/Shell/ShellProtocol.c
Modified: branches/UDK2015/ShellPkg/Application/Shell/ShellProtocol.c
===================================================================
--- branches/UDK2015/ShellPkg/Application/Shell/ShellProtocol.c 2015-12-18
07:39:06 UTC (rev 19408)
+++ branches/UDK2015/ShellPkg/Application/Shell/ShellProtocol.c 2015-12-18
07:39:35 UTC (rev 19409)
@@ -449,38 +449,37 @@
; FilePath = (FILEPATH_DEVICE_PATH*)NextDevicePathNode
(&FilePath->Header)
){
//
- // all the rest should be file path nodes
+ // If any node is not a file path node, then the conversion can not be
completed
//
if ((DevicePathType(&FilePath->Header) != MEDIA_DEVICE_PATH) ||
(DevicePathSubType(&FilePath->Header) != MEDIA_FILEPATH_DP)) {
FreePool(PathForReturn);
- PathForReturn = NULL;
- ASSERT(FALSE);
- } else {
- //
- // append the path part onto the filepath.
- //
- ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn !=
NULL));
+ return NULL;
+ }
- AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath),
FilePath);
- ASSERT (AlignedNode != NULL);
+ //
+ // append the path part onto the filepath.
+ //
+ ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn !=
NULL));
- // File Path Device Path Nodes 'can optionally add a "\" separator to
- // the beginning and/or the end of the Path Name string.'
- // (UEFI Spec 2.4 section 9.3.6.4).
- // If necessary, add a "\", but otherwise don't
- // (This is specified in the above section, and also implied by the
- // UEFI Shell spec section 3.7)
- if ((PathSize != 0) &&
- (PathForReturn != NULL) &&
- (PathForReturn[PathSize - 1] != L'\\') &&
- (AlignedNode->PathName[0] != L'\\')) {
- PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);
- }
+ AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath),
FilePath);
+ ASSERT (AlignedNode != NULL);
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize,
AlignedNode->PathName, 0);
- FreePool(AlignedNode);
+ // File Path Device Path Nodes 'can optionally add a "\" separator to
+ // the beginning and/or the end of the Path Name string.'
+ // (UEFI Spec 2.4 section 9.3.6.4).
+ // If necessary, add a "\", but otherwise don't
+ // (This is specified in the above section, and also implied by the
+ // UEFI Shell spec section 3.7)
+ if ((PathSize != 0) &&
+ (PathForReturn != NULL) &&
+ (PathForReturn[PathSize - 1] != L'\\') &&
+ (AlignedNode->PathName[0] != L'\\')) {
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);
}
+
+ PathForReturn = StrnCatGrow(&PathForReturn, &PathSize,
AlignedNode->PathName, 0);
+ FreePool(AlignedNode);
} // for loop of remaining nodes
}
if (PathForReturn != NULL) {
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits