public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec
@ 2018-01-06 20:03 Laszlo Ersek
  2018-01-08 18:07 ` Palmer, Thomas
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2018-01-06 20:03 UTC (permalink / raw)
  To: edk2-devel-01
  Cc: Jaben Carsey, Liming Gao, Rebecca Cran, Ruiyu Ni, Thomas Palmer

UefiShellLevel2CommandsLib (somewhat questionably) calls the
BaseLib-internal function InternalCharToUpper().

This function is declared in "MdePkg/Library/BaseLib/BaseLibInternals.h",
which is not a public library class header. UefiShellLevel2CommandsLib
therefore duplicates the function declaration, but a mistake was made: the
EFIAPI calling convention is not spelled out on the duplicated
declaration. Therefore calls made from UefiShellLevel2CommandsLib will not
match the actual function definition in "MdePkg/Library/BaseLib/String.c",
when GCC/X64 toolchains are used.

One consequence of this is that cross-filesystem copies don't work in the
UEFI shell (see the StrniCmp() function in
"UefiShellLevel2CommandsLib.c"). From the original report:

> FS0:\efi\ubuntu\> cp grubx64.efi fs1:\
>
> cp: The source and destination are the same.

Copy the declaration from "BaseLibInternals.h" to
"UefiShellLevel2CommandsLib.c" verbatim.

Reported-by: Rebecca Cran <rebecca@bluestop.org>
Analyzed-by: Thomas Palmer <thomas.palmer@hpe.com>
Analyzed-by: Liming Gao <liming.gao@intel.com>
Ref: http://mid.mail-archive.com/47cd17d8-f022-6ca5-2f52-06a8250f8d14@cran.org.uk
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Rebecca Cran <rebecca@bluestop.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Thomas Palmer <thomas.palmer@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
index 7948e53cfc46..e9ce63189224 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
@@ -268,8 +268,9 @@ VerifyIntermediateDirectories (
   @return Char as an upper case character.
 **/
 CHAR16
+EFIAPI
 InternalCharToUpper (
-  IN CONST CHAR16                    Char
+  IN      CHAR16                    Char
   );
 
 /**
-- 
2.14.1.3.gb7cf6e02401b



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec
  2018-01-06 20:03 [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec Laszlo Ersek
@ 2018-01-08 18:07 ` Palmer, Thomas
  2018-01-08 21:06   ` Carsey, Jaben
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer, Thomas @ 2018-01-08 18:07 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel-01
  Cc: Jaben Carsey, Liming Gao, Rebecca Cran, Ruiyu Ni

Reviewed by thomas.palmer@hpe.com


Regards,

Thomas Palmer

"I have only made this letter longer because I have not had the time to make it shorter" - Blaise Pascal

-----Original Message-----
From: Laszlo Ersek [mailto:lersek@redhat.com] 
Sent: Saturday, January 6, 2018 2:04 PM
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Jaben Carsey <jaben.carsey@intel.com>; Liming Gao <liming.gao@intel.com>; Rebecca Cran <rebecca@bluestop.org>; Ruiyu Ni <ruiyu.ni@intel.com>; Palmer, Thomas <thomas.palmer@hpe.com>
Subject: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec

UefiShellLevel2CommandsLib (somewhat questionably) calls the BaseLib-internal function InternalCharToUpper().

This function is declared in "MdePkg/Library/BaseLib/BaseLibInternals.h",
which is not a public library class header. UefiShellLevel2CommandsLib therefore duplicates the function declaration, but a mistake was made: the EFIAPI calling convention is not spelled out on the duplicated declaration. Therefore calls made from UefiShellLevel2CommandsLib will not match the actual function definition in "MdePkg/Library/BaseLib/String.c",
when GCC/X64 toolchains are used.

One consequence of this is that cross-filesystem copies don't work in the UEFI shell (see the StrniCmp() function in "UefiShellLevel2CommandsLib.c"). >From the original report:

> FS0:\efi\ubuntu\> cp grubx64.efi fs1:\
>
> cp: The source and destination are the same.

Copy the declaration from "BaseLibInternals.h" to "UefiShellLevel2CommandsLib.c" verbatim.

Reported-by: Rebecca Cran <rebecca@bluestop.org>
Analyzed-by: Thomas Palmer <thomas.palmer@hpe.com>
Analyzed-by: Liming Gao <liming.gao@intel.com>
Ref: http://mid.mail-archive.com/47cd17d8-f022-6ca5-2f52-06a8250f8d14@cran.org.uk
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Rebecca Cran <rebecca@bluestop.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Thomas Palmer <thomas.palmer@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
index 7948e53cfc46..e9ce63189224 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Command
+++ sLib.c
@@ -268,8 +268,9 @@ VerifyIntermediateDirectories (
   @return Char as an upper case character.
 **/
 CHAR16
+EFIAPI
 InternalCharToUpper (
-  IN CONST CHAR16                    Char
+  IN      CHAR16                    Char
   );
 
 /**
--
2.14.1.3.gb7cf6e02401b



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec
  2018-01-08 18:07 ` Palmer, Thomas
@ 2018-01-08 21:06   ` Carsey, Jaben
  2018-01-08 22:18     ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Carsey, Jaben @ 2018-01-08 21:06 UTC (permalink / raw)
  To: Palmer, Thomas, Laszlo Ersek, edk2-devel-01
  Cc: Gao, Liming, Rebecca Cran, Ni, Ruiyu

Agree that the internal use is questionable.

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: Palmer, Thomas [mailto:thomas.palmer@hpe.com]
> Sent: Monday, January 08, 2018 10:07 AM
> To: Laszlo Ersek <lersek@redhat.com>; edk2-devel-01 <edk2-
> devel@lists.01.org>
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Rebecca Cran <rebecca@bluestop.org>; Ni, Ruiyu
> <ruiyu.ni@intel.com>
> Subject: RE: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing
> EFIAPI call conv spec
> Importance: High
> 
> Reviewed by thomas.palmer@hpe.com
> 
> 
> Regards,
> 
> Thomas Palmer
> 
> "I have only made this letter longer because I have not had the time to make
> it shorter" - Blaise Pascal
> 
> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Saturday, January 6, 2018 2:04 PM
> To: edk2-devel-01 <edk2-devel@lists.01.org>
> Cc: Jaben Carsey <jaben.carsey@intel.com>; Liming Gao
> <liming.gao@intel.com>; Rebecca Cran <rebecca@bluestop.org>; Ruiyu Ni
> <ruiyu.ni@intel.com>; Palmer, Thomas <thomas.palmer@hpe.com>
> Subject: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI
> call conv spec
> 
> UefiShellLevel2CommandsLib (somewhat questionably) calls the BaseLib-
> internal function InternalCharToUpper().
> 
> This function is declared in "MdePkg/Library/BaseLib/BaseLibInternals.h",
> which is not a public library class header. UefiShellLevel2CommandsLib
> therefore duplicates the function declaration, but a mistake was made: the
> EFIAPI calling convention is not spelled out on the duplicated declaration.
> Therefore calls made from UefiShellLevel2CommandsLib will not match the
> actual function definition in "MdePkg/Library/BaseLib/String.c",
> when GCC/X64 toolchains are used.
> 
> One consequence of this is that cross-filesystem copies don't work in the
> UEFI shell (see the StrniCmp() function in "UefiShellLevel2CommandsLib.c").
> From the original report:
> 
> > FS0:\efi\ubuntu\> cp grubx64.efi fs1:\
> >
> > cp: The source and destination are the same.
> 
> Copy the declaration from "BaseLibInternals.h" to
> "UefiShellLevel2CommandsLib.c" verbatim.
> 
> Reported-by: Rebecca Cran <rebecca@bluestop.org>
> Analyzed-by: Thomas Palmer <thomas.palmer@hpe.com>
> Analyzed-by: Liming Gao <liming.gao@intel.com>
> Ref: http://mid.mail-archive.com/47cd17d8-f022-6ca5-2f52-
> 06a8250f8d14@cran.org.uk
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Rebecca Cran <rebecca@bluestop.org>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Thomas Palmer <thomas.palmer@hpe.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib
> .c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands
> Lib.c
> b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands
> Lib.c
> index 7948e53cfc46..e9ce63189224 100644
> ---
> a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Commands
> Lib.c
> +++
> b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Command
> +++ sLib.c
> @@ -268,8 +268,9 @@ VerifyIntermediateDirectories (
>    @return Char as an upper case character.
>  **/
>  CHAR16
> +EFIAPI
>  InternalCharToUpper (
> -  IN CONST CHAR16                    Char
> +  IN      CHAR16                    Char
>    );
> 
>  /**
> --
> 2.14.1.3.gb7cf6e02401b
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec
  2018-01-08 21:06   ` Carsey, Jaben
@ 2018-01-08 22:18     ` Laszlo Ersek
  0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2018-01-08 22:18 UTC (permalink / raw)
  To: Carsey, Jaben, Palmer, Thomas, edk2-devel-01
  Cc: Gao, Liming, Rebecca Cran, Ni, Ruiyu

On 01/08/18 22:06, Carsey, Jaben wrote:
> Agree that the internal use is questionable.
> 
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> 
>> -----Original Message-----
>> From: Palmer, Thomas [mailto:thomas.palmer@hpe.com]
>> Sent: Monday, January 08, 2018 10:07 AM
>> To: Laszlo Ersek <lersek@redhat.com>; edk2-devel-01 <edk2-
>> devel@lists.01.org>
>> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Gao, Liming
>> <liming.gao@intel.com>; Rebecca Cran <rebecca@bluestop.org>; Ni, Ruiyu
>> <ruiyu.ni@intel.com>
>> Subject: RE: [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing
>> EFIAPI call conv spec
>> Importance: High
>>
>> Reviewed by thomas.palmer@hpe.com
>>
>>
>> Regards,
>>
>> Thomas Palmer

Commit 038720e89959.

Thank you both!
Laszlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-08 22:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-06 20:03 [PATCH] ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv spec Laszlo Ersek
2018-01-08 18:07 ` Palmer, Thomas
2018-01-08 21:06   ` Carsey, Jaben
2018-01-08 22:18     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox