From nobody Sun Feb 8 18:30:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96125+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96125+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1667953330; cv=none; d=zohomail.com; s=zohoarc; b=LmEGiWS6L4dIdIWqVBKiefXdrZDWltdayBW6b3DZwJxito1f1lxC6bcMS6Q3xGbZYCHOuuOenMgWtDm82yZA/FjCjCFjeF4TOZ82Kxh4A7QVE6GwlWypo7J5VldAZ94SBPVk19DyIC283CQ8/tK3wNIMICZzWb1VCZX1hsg3+L0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667953330; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=4tdy0802XCQuIgrxWDeTKDwXNzV3xXe1TBBNzzagkTw=; b=HO0sFkNZnKJoJXOTpr32nRqGV3Iro/YdhKdyiL6a1WZ5kk2GekHWFaJ+9xS1zx2LYejjM9TXwms/djjZpJXDaxQE13+q4rIWETItPcOMZ0csDEs/kmpLx8DJ5zNlQBgXfioQy9neCH6cdiCCewPOJIa5LoL6Ab4eWK5SW86LYkw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96125+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1667953330338307.206296586597; Tue, 8 Nov 2022 16:22:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id rcT1YY1788612xQlNmqrXNBv; Tue, 08 Nov 2022 16:22:08 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.671.1667953328048291253 for ; Tue, 08 Nov 2022 16:22:08 -0800 X-Received: from localhost.localdomain (unknown [47.201.8.94]) by linux.microsoft.com (Postfix) with ESMTPSA id CD29E20B9F80; Tue, 8 Nov 2022 16:22:06 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CD29E20B9F80 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen , Sean Brogan , Michael D Kinney Subject: [edk2-devel] [PATCH v2 1/2] BaseTools: Fix wrong type of arguments to formatting functions Date: Tue, 8 Nov 2022 19:21:40 -0500 Message-Id: <20221109002141.1804-2-mikuback@linux.microsoft.com> In-Reply-To: <20221109002141.1804-1-mikuback@linux.microsoft.com> References: <20221109002141.1804-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com X-Gm-Message-State: pSUllAdf9tIq8H5d2cHqJa95x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1667953328; bh=d3+a4f+l9R87QwU7jOyc565wcBkx1cTq2rWEtit3K8I=; h=Cc:Date:From:Reply-To:Subject:To; b=KnfDonG6x1ANqKxX1R6+Wf68wLJrquJzybTwmE+1EWh4HXtvqXlxtos46660HrhyhJY GnVslWAnXP20zqW65CTZMPHh/pEDW/GnEtSJWdnkOPmJ5LvjY5FdwchpYLPNc/FFVWQoV 4VTg9q1g/P44eSbS85TdnhqgqiyhWHZxHG8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1667953331386100002 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki Fixes issues found with the cpp/wrong-type-format-argument CodeQL rule in BaseTools. Reference: https://cwe.mitre.org/data/definitions/686.html The following CodeQL errors are resolved: 1. Check failure on line 1115 in BaseTools/Source/C/EfiRom/EfiRom.c - This argument should be of type 'int' but is of type 'char *'. - This argument should be of type 'int' but is of type 'signed char *'. 2. Check failure on line 359 in BaseTools/Source/C/GenFw/Elf32Convert.c - This argument should be of type 'CHAR8 *' but is of type 'unsigned int'. 3. Check failure on line 1841 in BaseTools/Source/C/GenFw/Elf64Convert.c - This argument should be of type 'unsigned int' but is of type 'unsigned long long'. 4. Check failure on line 1871 in BaseTools/Source/C/GenFw/Elf64Convert.c - This argument should be of type 'unsigned int' but is of type 'unsigned long long'. 5. Check failure on line 2400 in BaseTools/Source/C/GenFv/GenFvInternalLib.c - This argument should be of type 'unsigned long long' but is of type 'unsigned int'. 6. Check failure on line 1099 in BaseTools/Source/C/GenFw/Elf64Convert.c - This argument should be of type 'CHAR8 *' but is of type 'unsigned int'. 7. Check failure on line 1098 in BaseTools/Source/C/GenSec/GenSec.c - This argument should be of type 'CHAR8 *' but is of type 'char **'. 8. Check failure on line 911 in BaseTools/Source/C/GenSec/GenSec.c - This argument should be of type 'CHAR8 *' but is of type 'char **'. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Cc: Sean Brogan Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Sean Brogan --- BaseTools/Source/C/EfiRom/EfiRom.c | 2 +- BaseTools/Source/C/GenFv/GenFvInternalLib.c | 2 +- BaseTools/Source/C/GenFw/Elf32Convert.c | 2 +- BaseTools/Source/C/GenFw/Elf64Convert.c | 6 +++--- BaseTools/Source/C/GenSec/GenSec.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom= /EfiRom.c index 2506f559d574..fa7bf0e62e6d 100644 --- a/BaseTools/Source/C/EfiRom/EfiRom.c +++ b/BaseTools/Source/C/EfiRom/EfiRom.c @@ -1112,7 +1112,7 @@ Routine Description: goto Done; } if (DebugLevel > 9) { - Error (NULL, 0, 2000, "Invalid option value", "Debug Level range= is 0-9, current input level is %d", Argv[1]); + Error (NULL, 0, 2000, "Invalid option value", "Debug Level range= is 0-9, current input level is %llu", DebugLevel); ReturnStatus =3D 1; goto Done; } diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source= /C/GenFv/GenFvInternalLib.c index b5b942500334..6bd59515b1aa 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -2397,7 +2397,7 @@ Routine Description: VerboseMsg("SecCore entry point Address =3D 0x%llX", (unsigned long long= ) SecCoreEntryAddress); VerboseMsg("BaseAddress =3D 0x%llX", (unsigned long long) FvInfo->BaseAd= dress); bSecCore =3D (UINT32)(SecCoreEntryAddress - FvInfo->BaseAddress); - VerboseMsg("offset =3D 0x%llX", bSecCore); + VerboseMsg("offset =3D 0x%X", bSecCore); =20 if(bSecCore > 0x0fffff) { Error(NULL, 0, 3000, "Invalid", "SEC Entry point must be within 1MB of= start of the FV"); diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/G= enFw/Elf32Convert.c index d917a444c82d..87d7f133f132 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -356,7 +356,7 @@ ScanSections32 ( mCoffOffset +=3D sizeof (EFI_IMAGE_NT_HEADERS32); break; default: - VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e= _machine); + VerboseMsg ("%u unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e= _machine); mCoffOffset +=3D sizeof (EFI_IMAGE_NT_HEADERS32); break; } diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/G= enFw/Elf64Convert.c index c6092269e2d1..8b50774beb1e 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -1096,7 +1096,7 @@ ScanSections64 ( break; =20 default: - VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_m= achine); + VerboseMsg ("%u unknown e_machine type. Assume X64", (UINTN)mEhdr->e_m= achine); NtHdr->Pe32Plus.FileHeader.Machine =3D EFI_IMAGE_MACHINE_X64; NtHdr->Pe32Plus.OptionalHeader.Magic =3D EFI_IMAGE_NT_OPTIONAL_HDR64_M= AGIC; } @@ -1837,7 +1837,7 @@ WriteRelocations64 ( case R_X86_64_REX_GOTPCRELX: break; case R_X86_64_64: - VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X", + VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08llX", mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - S= ecShdr->sh_addr)); CoffAddFixup( (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] @@ -1867,7 +1867,7 @@ WriteRelocations64 ( // // case R_X86_64_32S: case R_X86_64_32: - VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X", + VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08llX", mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - S= ecShdr->sh_addr)); CoffAddFixup( (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec= /GenSec.c index a4c2d19aa6f4..cf24d821aa96 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -908,7 +908,7 @@ Routine Description: if (FileBuffer !=3D NULL) { free (FileBuffer); } - Error (NULL, 0, 2000, "Invalid parameter", "the size of input file %s = can't be zero", InputFileName); + Error (NULL, 0, 2000, "Invalid parameter", "the size of input file %s = can't be zero", *InputFileName); return EFI_NOT_FOUND; } =20 @@ -1095,7 +1095,7 @@ Routine Description: if (FileBuffer !=3D NULL) { free (FileBuffer); } - Error (NULL, 0, 2000, "Invalid parameter", "the size of input file %s = can't be zero", InputFileName); + Error (NULL, 0, 2000, "Invalid parameter", "the size of input file %s = can't be zero", *InputFileName); return EFI_NOT_FOUND; } =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96125): https://edk2.groups.io/g/devel/message/96125 Mute This Topic: https://groups.io/mt/94903613/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-