From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.52856.1678565553995578466 for ; Sat, 11 Mar 2023 12:12:34 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=fJw76FAE; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678565553; x=1710101553; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qxFLt3TUPPHae/mzdAd8fDBUnOIZmOpkHTO/26Sx5Oc=; b=fJw76FAErrUN8SPc0EBV+x7FQoFjqxh7cePzYKgXNoiSEstvxbQN2cxV i1eTaVwjl2E2i4tIMcNb7N0AAfT6qR8YW9CpxCOZPL3Y+xuIMOpbvoYae N7pNE0taaL6gE6beW1K+wb97yjo6T1k8/YUTyGNvr4+WYXKaxWQTESvrI VU7gDVbJk9r2oPwCDhhjUgeCJhmmcvwCtvwwjsjumLoJyI3krd2L8oZr/ BdOXDQ1KTErlPT4E5K6cPImR8JxgSZNrgOOs0Ni+80t9z9tkRWl5QTOK6 aD149/qN0luFAT2xQo+C0kDTi25r1za162SV3Exfq+tH8WCEEPlzPiIoj Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10646"; a="336958484" X-IronPort-AV: E=Sophos;i="5.98,253,1673942400"; d="scan'208";a="336958484" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2023 12:12:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10646"; a="788434385" X-IronPort-AV: E=Sophos;i="5.98,253,1673942400"; d="scan'208";a="788434385" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.90.233]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2023 12:12:32 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Ray Ni , Zhichao Gao Subject: [Patch 1/1] ShellPkg/Library: Fix 32-bit truncation of pointer values Date: Sat, 11 Mar 2023 12:12:16 -0800 Message-Id: <20230311201216.1856-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.39.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4366 Update C and UNI files that are incorrectly using %x or %08x instead of %p for pointer values. On 64-bit systems, this is truncating pointer values above 4GB. In reviewing ShellPkg for this issue some unused UNI strings with incorrect format specifiers were removed instead of being fixed. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Michael D Kinney --- .../UefiHandleParsingLib.uni | 18 +++++------ .../UefiShellDebug1CommandsLib.uni | 2 -- .../Library/UefiShellDriver1CommandsLib/Dh.c | 2 +- .../UefiShellDriver1CommandsLib.uni | 31 +------------------ .../UefiShellLevel2CommandsLib.uni | 3 +- 5 files changed, 12 insertions(+), 44 deletions(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index aa3396cea94d..6bcb3cd9e461 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni @@ -173,7 +173,7 @@ #string STR_HII #language en-US "HII" #string STR_HII_FORM_CALLBACK #language en-US "HIICallback" -#string STR_TXT_OUT_DUMP_HEADER #language en-US " Address: %%H%X%%N Attrib %02x" +#string STR_TXT_OUT_DUMP_HEADER #language en-US " Address: %%H%p%%N Attrib %02x" #string STR_TXT_OUT_DUMP_LINE #language en-US "\r\n %c mode %d: Col %d Row %d" #string STR_DRIVER_FAM_OVERRIDE #language en-US "DriverFamilyOverride" @@ -361,7 +361,7 @@ #string STR_DEBUGSUPPORT_INFO #language en-US " Isa = %s" #string STR_DEBUGSUPPORT_UNKNOWN #language en-US " Unknown (%%H%s%%N)" -#string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %%H%x%%N\r\n" +#string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %%H%p%%N\r\n" #string STR_PCIRB_DUMP_SEG #language en-US " Segment #.....: %%H%x%%N\r\n" #string STR_PCIRB_DUMP_ATT #language en-US " Attributes....: %%H%x%%N\r\n" #string STR_PCIRB_DUMP_SUPPORTS #language en-US " Supports......: %%H%x%%N\r\n" @@ -375,7 +375,7 @@ " Device #......: %02x\r\n" " Function #....: %02x\r\n" " ROM Size......: %lx\r\n" - " ROM Location..: %08x\r\n" + " ROM Location..: %p\r\n" " Vendor ID.....: %04x\r\n" " Device ID.....: %04x\r\n" " Class Code....: %02x %02x %02x\r\n" @@ -388,18 +388,18 @@ #string STR_LI_DUMP_NAME #language en-US " Name..........: %%H%s%%N\r\n" #string STR_LI_DUMP_MAIN #language en-US " Revision......: %%H0x%08x%%N\r\n" - " ParentHandle..: %%H%x%%N\r\n" - " SystemTable...: %%H%x%%N\r\n" - " DeviceHandle..: %%H%x%%N\r\n" + " ParentHandle..: %%H%p%%N\r\n" + " SystemTable...: %%H%p%%N\r\n" + " DeviceHandle..: %%H%p%%N\r\n" " FilePath......: %%H%s%%N\r\n" " PdbFileName...: %%H%a%%N\r\n" " OptionsSize...: %%H%x%%N\r\n" - " LoadOptions...: %%H%x%%N\r\n" - " ImageBase.....: %%H%x%%N\r\n" + " LoadOptions...: %%H%p%%N\r\n" + " ImageBase.....: %%H%p%%N\r\n" " ImageSize.....: %%H%Lx%%N\r\n" " CodeType......: %%H%s%%N\r\n" " DataType......: %%H%s%%N\r\n" - " Unload........: %%H%x%%N" + " Unload........: %%H%p%%N" #string STR_GOP_DUMP_MAIN #language en-US " Max Mode..............: %%H0x%08x%%N\r\n" " Current Mode..........: %%H0x%08x%%N\r\n" diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni index b1d239ed37ea..4fedc0d1493c 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni @@ -103,7 +103,6 @@ #string STR_DMEM_HEADER_ROW #language en-US "Memory Address %016LX %X Bytes\r\n" #string STR_DMEM_MMIO_HEADER_ROW #language en-US "Memory Mapped IO Address %016LX %X Bytes\r\n" -#string STR_DMEM_DATA_ROW #language en-US "%08X: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x *%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c*\r\n" #string STR_DMEM_SYSTEM_TABLE #language en-US "\r\nValid EFI Header at Address %016Lx\r\n" "---------------------------------------------\r\n" "System: Table Structure size %08x revision %08x\r\n" @@ -1171,4 +1170,3 @@ " \r\n" " * To edit memory region starting at address 0x00000000 with size of 2 bytes:\r\n" " fs0:\> hexedit -m 0 2\r\n" - diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c index dd9aba50d754..d17d50fe13fa 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c @@ -325,7 +325,7 @@ GetProtocolInfoString ( Status = gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance); if (!EFI_ERROR (Status)) { StrnCatGrow (&RetVal, &Size, L"(%H", 0); - UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%x", Instance); + UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%p", Instance); StrnCatGrow (&RetVal, &Size, InstanceStr, 0); StrnCatGrow (&RetVal, &Size, L"%N)", 0); } diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni index fc4986c8c62f..230779a4b30d 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni @@ -101,7 +101,7 @@ #string STR_DH_OUTPUT_GUID_HEADER #language en-US "Handle dump by protocol '%g'\r\n" #string STR_DH_OUTPUT_NAME_HEADER #language en-US "Handle dump by protocol '%s'\r\n" #string STR_DH_OUTPUT_SINGLE_D #language en-US "%H%02x%N: %s\r\n" -#string STR_DH_OUTPUT_SINGLE #language en-US "%H%02x%N: %x\r\n%s" +#string STR_DH_OUTPUT_SINGLE #language en-US "%H%02x%N: %p\r\n%s" #string STR_DH_OUTPUT_SFO #language en-US "%s, %s, %s, %H%02x%N, %s, %s\r\n" #string STR_DH_OUTPUT_DRIVER1 #language en-US " Controller Name : %H%s%N\r\n" #string STR_DH_OUTPUT_DRIVER2 #language en-US " Device Path : %H%s%N\r\n" @@ -128,18 +128,6 @@ #string STR_DEV_TREE_OUTPUT #language en-US "Ctrl[%H%02x%N] %s\r\n" #string STR_UNLOAD_CONF #language en-US "%HUnload%N - Handle [%H%02x%N]. [y/n]?\r\n" -#string STR_UNLOAD_VERBOSE #language en-US "" -"Handle [%H%02x%N] (%08x)\r\n" -" Image (%08x)\r\n" -" ParentHandle..: %08x\r\n" -" SystemTable...: %08x\r\n" -" DeviceHandle..: %08x\r\n" -" FilePath......: %s\r\n" -" PDBFileName...: %a\r\n" -" ImageBase.....: %08x\r\n" -" ImageSize.....: %Ld\r\n" -" CodeType......: %s\r\n" -" DataType......: %s\r\n" #string STR_OPENINFO_HEADER_LINE #language en-US "Handle %H%02x%N (%H%0p%N)\r\n" #string STR_OPENINFO_LINE #language en-US " Drv[%H%02x%N] Ctrl[%H%02x%N] Cnt(%H%02x%N) %H%s Image%N(%s)\r\n" @@ -734,20 +722,3 @@ " violation.\r\n" " SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n" " formatted or its value was out of bounds.\r\n" - - - - - - - - - - - - - - - - - diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni index 8ce015746f7c..0a0cd3090e0f 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni @@ -134,7 +134,7 @@ #string STR_LOAD_NOT_IMAGE #language en-US "Image '%s' is not an image.\r\n" #string STR_LOAD_NOT_DRIVER #language en-US "Image '%s' is not a driver.\r\n" -#string STR_LOAD_LOADED #language en-US "Image '%s' loaded at %x - %r\r\n" +#string STR_LOAD_LOADED #language en-US "Image '%s' loaded at %p - %r\r\n" #string STR_LOAD_ERROR #language en-US "Image '%s' error in StartImage: %r\r\n" #string STR_LS_LINE_START_ALL #language en-US "%t %5s %1c % ,L11d " @@ -1076,4 +1076,3 @@ " SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n" " violation.\r\n" " SHELL_NOT_FOUND The target file-system was not found.\r\n" - -- 2.39.1.windows.1