I would also note that GetAlias() has similar logic, but does, in fact use the 
AliasLower. As far as I can tell, the specification does not say anything about 
case-insensitive, so I believe this to be in error.

Tim

-----Original Message-----
From: edk2-devel [mailto:[email protected]] On Behalf Of Tim Lewis
Sent: Thursday, October 27, 2016 2:11 PM
To: [email protected]
Subject: [edk2] [shell] AliasLower never used in InternalSetAlias

In the function InternalSetAlias, it appears that AliasLower is duplicated 
(fromAlias), converted to lower case and freed ,but never actually used. Am I 
missing something?

  // Convert to lowercase to make aliases case-insensitive
  if (Alias != NULL) {
    AliasLower = AllocateCopyPool (StrSize (Alias), Alias);
    if (AliasLower == NULL) {
      return EFI_OUT_OF_RESOURCES;
    }
    ToLower (AliasLower);
  } else {
    AliasLower = NULL;
  }

  //
  // We must be trying to remove one if Alias is NULL
  //
  if (Alias == NULL) {
    //
    // remove an alias (but passed in COMMAND parameter)
    //
    Status = (gRT->SetVariable((CHAR16*)Command, &gShellAliasGuid, 0, 0, NULL));
  } else {
    //
    // Add and replace are the same
    //

    // We dont check the error return on purpose since the variable may not 
exist.
    gRT->SetVariable((CHAR16*)Command, &gShellAliasGuid, 0, 0, NULL);

    Status = (gRT->SetVariable((CHAR16*)Alias, &gShellAliasGuid, 
EFI_VARIABLE_BOOTSERVICE_ACCESS|(Volatile?0:EFI_VARIABLE_NON_VOLATILE), 
StrSize(Command), (VOID*)Command));
  }

  if (Alias != NULL) {
    FreePool (AliasLower);
  }
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to