ShellPkg: smbiosview - print field values as unsigned integers

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>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
This commit is contained in:
Rebecca Cran 2020-05-07 00:52:05 +08:00 committed by mergify[bot]
parent b90beadfae
commit 8927e27777
1 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@
#define PRINT_STRUCT_VALUE(pStruct, type, element) \ #define PRINT_STRUCT_VALUE(pStruct, type, element) \
do { \ do { \
ShellPrintEx(-1,-1,L"%a",#element); \ 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); } while (0);
#define PRINT_STRUCT_VALUE_H(pStruct, type, element) \ #define PRINT_STRUCT_VALUE_H(pStruct, type, element) \
@ -634,8 +634,8 @@ SmbiosPrintStructure (
NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3; NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3;
PRINT_PENDING_STRING (Struct, Type14, GroupName); PRINT_PENDING_STRING (Struct, Type14, GroupName);
for (Index = 0; Index < NumOfItem; Index++) { 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"ItemType %u: %u\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"ItemHandle %u: %u\n", Index + 1, Struct->Type14->Group[Index].ItemHandle);
} }
} }
break; break;