public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] ShellPkg: smbiosview - print field values as unsigned integers
@ 2020-05-06 16:52 Rebecca Cran
  2020-05-06 18:57 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Rebecca Cran @ 2020-05-06 16:52 UTC (permalink / raw)
  To: devel; +Cc: Rebecca Cran, Ray Ni, Zhichao Gao, Philippe Mathieu-Daude

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

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
---
 .../UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index a75caff3de34..1ea7b84bd0fa 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) \
@@ -634,8 +634,8 @@ SmbiosPrintStructure (
       NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3;
       PRINT_PENDING_STRING (Struct, Type14, GroupName);
       for (Index = 0; Index < NumOfItem; Index++) {
-        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);
+        ShellPrintEx(-1,-1,L"ItemType %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemType);
+        ShellPrintEx(-1,-1,L"ItemHandle %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemHandle);
       }
     }
     break;
-- 
2.26.2



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

* Re: [PATCH v2 1/1] ShellPkg: smbiosview - print field values as unsigned integers
  2020-05-06 16:52 [PATCH v2 1/1] ShellPkg: smbiosview - print field values as unsigned integers Rebecca Cran
@ 2020-05-06 18:57 ` Philippe Mathieu-Daudé
  2020-06-11  4:49   ` Gao, Zhichao
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-06 18:57 UTC (permalink / raw)
  To: Rebecca Cran, devel; +Cc: Ray Ni, Zhichao Gao

On 5/6/20 6:52 PM, Rebecca Cran wrote:
> This prevents overflow when printing DWORD fields such as the type 17
> tables's extended DIMM size.
> 
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Cc: Philippe Mathieu-Daude <philmd@redhat.com>
> ---
>   .../UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c       | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
> index a75caff3de34..1ea7b84bd0fa 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) \
> @@ -634,8 +634,8 @@ SmbiosPrintStructure (
>         NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3;
>         PRINT_PENDING_STRING (Struct, Type14, GroupName);
>         for (Index = 0; Index < NumOfItem; Index++) {
> -        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);
> +        ShellPrintEx(-1,-1,L"ItemType %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemType);
> +        ShellPrintEx(-1,-1,L"ItemHandle %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemHandle);
>         }
>       }
>       break;
> 

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


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

* Re: [PATCH v2 1/1] ShellPkg: smbiosview - print field values as unsigned integers
  2020-05-06 18:57 ` Philippe Mathieu-Daudé
@ 2020-06-11  4:49   ` Gao, Zhichao
  0 siblings, 0 replies; 3+ messages in thread
From: Gao, Zhichao @ 2020-06-11  4:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Rebecca Cran, devel@edk2.groups.io; +Cc: Ni, Ray

Reviewed- by: Zhichao Gao <zhichao.gao@intel.com>

Thanks,
Zhichao

> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> Sent: Thursday, May 7, 2020 2:57 AM
> To: Rebecca Cran <rebecca@bsdio.com>; devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: Re: [PATCH v2 1/1] ShellPkg: smbiosview - print field values as unsigned
> integers
> 
> On 5/6/20 6:52 PM, Rebecca Cran wrote:
> > This prevents overflow when printing DWORD fields such as the type 17
> > tables's extended DIMM size.
> >
> > Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Zhichao Gao <zhichao.gao@intel.com>
> > Cc: Philippe Mathieu-Daude <philmd@redhat.com>
> > ---
> >   .../UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c       | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git
> > a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
> > b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
> > index a75caff3de34..1ea7b84bd0fa 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) \ @@ -634,8
> > +634,8 @@ SmbiosPrintStructure (
> >         NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3;
> >         PRINT_PENDING_STRING (Struct, Type14, GroupName);
> >         for (Index = 0; Index < NumOfItem; Index++) {
> > -        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);
> > +        ShellPrintEx(-1,-1,L"ItemType %u: %u\n", Index + 1, Struct->Type14-
> >Group[Index].ItemType);
> > +        ShellPrintEx(-1,-1,L"ItemHandle %u: %u\n", Index + 1,
> > + Struct->Type14->Group[Index].ItemHandle);
> >         }
> >       }
> >       break;
> >
> 
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


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

end of thread, other threads:[~2020-06-11  4:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-06 16:52 [PATCH v2 1/1] ShellPkg: smbiosview - print field values as unsigned integers Rebecca Cran
2020-05-06 18:57 ` Philippe Mathieu-Daudé
2020-06-11  4:49   ` Gao, Zhichao

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