public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg: smbiosview - print field values as unsigned integers
@ 2020-04-24 22:55 Rebecca Cran
  2020-04-27  8:54 ` [edk2-devel] " Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Rebecca Cran @ 2020-04-24 22:55 UTC (permalink / raw)
  To: devel; +Cc: Rebecca Cran, Ray Ni, Zhichao Gao

This prevents overflow when printing DWORD fields such as the type 17
tables's extended DIMM size.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 .../Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index a75caff3de..be8b7c0a97 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -49,7 +49,7 @@
 #define PRINT_STRUCT_VALUE(pStruct, type, element) \
   do { \
     ShellPrintEx(-1,-1,L"%a",#element); \
-    ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \
+    ShellPrintEx(-1,-1,L": %u\n", (pStruct->type->element)); \
   } while (0);
 
 #define PRINT_STRUCT_VALUE_H(pStruct, type, element) \
-- 
2.25.1



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

* Re: [edk2-devel] [PATCH] ShellPkg: smbiosview - print field values as unsigned integers
  2020-04-24 22:55 [PATCH] ShellPkg: smbiosview - print field values as unsigned integers Rebecca Cran
@ 2020-04-27  8:54 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-27  8:54 UTC (permalink / raw)
  To: devel, rebecca; +Cc: Ray Ni, Zhichao Gao

Hi Rebecca,

On 4/25/20 12:55 AM, Rebecca Cran wrote:
> This prevents overflow when printing DWORD fields such as the type 17
> tables's extended DIMM size.

Similar issue with type 14:

         ShellPrintEx(-1,-1,L"ItemType %d: %d\n", Index + 1, 
Struct->Type14->Group[Index].ItemType);

         ShellPrintEx(-1,-1,L"ItemHandle %d: %d\n", Index + 1, 
Struct->Type14->Group[Index].ItemHandle);


Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>   .../Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c   | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
> index a75caff3de..be8b7c0a97 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
> @@ -49,7 +49,7 @@
>   #define PRINT_STRUCT_VALUE(pStruct, type, element) \
>     do { \
>       ShellPrintEx(-1,-1,L"%a",#element); \
> -    ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \
> +    ShellPrintEx(-1,-1,L": %u\n", (pStruct->type->element)); \
>     } while (0);
>   
>   #define PRINT_STRUCT_VALUE_H(pStruct, type, element) \
> 


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

end of thread, other threads:[~2020-04-27  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-24 22:55 [PATCH] ShellPkg: smbiosview - print field values as unsigned integers Rebecca Cran
2020-04-27  8:54 ` [edk2-devel] " Philippe Mathieu-Daudé

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