diff options
Diffstat (limited to 'ShellPkg')
9 files changed, 72 insertions, 40 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 483fe4d..ae3e943 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -1262,9 +1262,11 @@ LocateStartupScript ( InternalEfiShellSetEnv (L"homefilesystem", StartupScriptPath, TRUE);
- StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0);
- PathRemoveLastItem (StartupScriptPath);
- StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, mStartupScript, 0);
+ if ((DevicePathType (FileDevicePath) == MEDIA_DEVICE_PATH) && (DevicePathSubType (FileDevicePath) == MEDIA_FILEPATH_DP)) {
+ StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, ((FILEPATH_DEVICE_PATH *)FileDevicePath)->PathName, 0);
+ PathRemoveLastItem (StartupScriptPath);
+ StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, mStartupScript, 0);
+ }
}
//
diff --git a/ShellPkg/Application/Shell/ShellEnvVar.c b/ShellPkg/Application/Shell/ShellEnvVar.c index b97cfe9..9e84d7f 100644 --- a/ShellPkg/Application/Shell/ShellEnvVar.c +++ b/ShellPkg/Application/Shell/ShellEnvVar.c @@ -285,19 +285,23 @@ SetEnvironmentVariableList ( //
// set all the variables from the list
//
- for ( Node = (ENV_VAR_LIST *)GetFirstNode (ListHead)
- ; !IsNull (ListHead, &Node->Link)
- ; Node = (ENV_VAR_LIST *)GetNextNode (ListHead, &Node->Link)
- )
- {
- Size = StrSize (Node->Val) - sizeof (CHAR16);
- if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) {
- Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (Node->Key, Size, Node->Val);
- } else {
- Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val);
- }
+ if ((ListHead != NULL) && !IsListEmpty (ListHead)) {
+ for ( Node = (ENV_VAR_LIST *)GetFirstNode (ListHead)
+ ; !IsNull (ListHead, &Node->Link)
+ ; Node = (ENV_VAR_LIST *)GetNextNode (ListHead, &Node->Link)
+ )
+ {
+ if ((Node->Key != NULL) && (Node->Val != NULL)) {
+ Size = StrSize (Node->Val) - sizeof (CHAR16);
+ if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) {
+ Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (Node->Key, Size, Node->Val);
+ } else {
+ Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val);
+ }
- ASSERT_EFI_ERROR (Status);
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
}
FreeEnvironmentVariableList (ListHead);
@@ -441,7 +445,7 @@ ShellFindEnvVarInList ( ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
)
{
- if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
+ if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0) && (Node->Val != NULL)) {
*Value = AllocateCopyPool (StrSize (Node->Val), Node->Val);
*ValueSize = StrSize (Node->Val);
if (Atts != NULL) {
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 3bc6239..646294d 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -2853,7 +2853,11 @@ EfiShellGetEnvEx ( ; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
)
{
- ASSERT (Node->Key != NULL);
+ if (Node->Key == NULL) {
+ ASSERT (FALSE);
+ continue;
+ }
+
Size += StrSize (Node->Key);
}
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c index b0c77e4..44c2ed9 100644 --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c @@ -398,7 +398,11 @@ ShellCommandIsCommandOnInternalList ( ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
)
{
- ASSERT (Node->CommandString != NULL);
+ if (Node->CommandString == NULL) {
+ ASSERT (FALSE);
+ continue;
+ }
+
if (gUnicodeCollation->StriColl (
gUnicodeCollation,
(CHAR16 *)CommandString,
@@ -485,7 +489,11 @@ ShellCommandGetInternalCommandHelp ( ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
)
{
- ASSERT (Node->CommandString != NULL);
+ if (Node->CommandString == NULL) {
+ ASSERT (FALSE);
+ continue;
+ }
+
if (gUnicodeCollation->StriColl (
gUnicodeCollation,
(CHAR16 *)CommandString,
@@ -672,23 +680,25 @@ ShellCommandRegisterCommandName ( //
// Get Lexical Comparison Value between PrevCommand and Command list entry
//
- LexicalMatchValue = gUnicodeCollation->StriColl (
- gUnicodeCollation,
- PrevCommand->CommandString,
- Command->CommandString
- );
+ if ((PrevCommand->CommandString != NULL) && (Command->CommandString != NULL)) {
+ LexicalMatchValue = gUnicodeCollation->StriColl (
+ gUnicodeCollation,
+ PrevCommand->CommandString,
+ Command->CommandString
+ );
- //
- // Swap PrevCommand and Command list entry if PrevCommand list entry
- // is alphabetically greater than Command list entry
- //
- if (LexicalMatchValue > 0) {
- Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)SwapListEntries (&PrevCommand->Link, &Command->Link);
- } else if (LexicalMatchValue < 0) {
//
- // PrevCommand entry is lexically lower than Command entry
+ // Swap PrevCommand and Command list entry if PrevCommand list entry
+ // is alphabetically greater than Command list entry
//
- break;
+ if (LexicalMatchValue > 0) {
+ Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)SwapListEntries (&PrevCommand->Link, &Command->Link);
+ } else if (LexicalMatchValue < 0) {
+ //
+ // PrevCommand entry is lexically lower than Command entry
+ //
+ break;
+ }
}
}
@@ -758,7 +768,11 @@ ShellCommandRunCommandHandler ( ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
)
{
- ASSERT (Node->CommandString != NULL);
+ if (Node->CommandString == NULL) {
+ ASSERT (FALSE);
+ continue;
+ }
+
if (gUnicodeCollation->StriColl (
gUnicodeCollation,
(CHAR16 *)CommandString,
@@ -831,7 +845,11 @@ ShellCommandGetManFileNameHandler ( ; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
)
{
- ASSERT (Node->CommandString != NULL);
+ if (Node->CommandString == NULL) {
+ ASSERT (FALSE);
+ continue;
+ }
+
if (gUnicodeCollation->StriColl (
gUnicodeCollation,
(CHAR16 *)CommandString,
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c index dd3d7a7..37bccea 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -491,6 +491,11 @@ ShellCommandRunDmem ( continue;
}
+ if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gFdtTableGuid)) {
+ DtbTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
+ continue;
+ }
+
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMemoryAttributesTableGuid)) {
MemoryAttributesTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
continue;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c index 42d766e..bf68eb1 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -3011,7 +3011,7 @@ DisplayMmBankConnections ( //
// Divide it to high and low
//
- High = (UINT8)(BankConnections & 0xF0);
+ High = (UINT8)((BankConnections & 0xF0)>>4);
Low = (UINT8)(BankConnections & 0x0F);
if (High != 0xF) {
if (Low != 0xF) {
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf index 91b48e8..0f4068d 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf @@ -96,6 +96,7 @@ MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec
MdeModulePkg/MdeModulePkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
MemoryAllocationLib
@@ -144,3 +145,4 @@ gEfiConfProfilesUefiSpecGuid ## SOMETIMES_CONSUMES ## GUID
gEfiConfProfilesEbbrSpec21Guid ## SOMETIMES_CONSUMES ## GUID
gEfiConfProfilesEbbrSpec22Guid ## SOMETIMES_CONSUMES ## GUID
+ gFdtTableGuid ## SOMETIMES_CONSUMES ## SystemTable
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c index 4f39863..3bec32b 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c @@ -520,10 +520,6 @@ ShellCommandRunConnect ( }
Handle1 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
- if (EFI_ERROR (Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
- ShellStatus = SHELL_INVALID_PARAMETER;
- }
} else {
Handle1 = NULL;
}
diff --git a/ShellPkg/ShellPkg.ci.yaml b/ShellPkg/ShellPkg.ci.yaml index 2c3a70d..4f5c69d 100644 --- a/ShellPkg/ShellPkg.ci.yaml +++ b/ShellPkg/ShellPkg.ci.yaml @@ -35,6 +35,7 @@ "MdePkg/MdePkg.dec",
"MdeModulePkg/MdeModulePkg.dec",
"ShellPkg/ShellPkg.dec",
+ "EmbeddedPkg/EmbeddedPkg.dec",
"NetworkPkg/NetworkPkg.dec"
],
# For host based unit tests
|