Updates the fork repo to the TianoCore Uncrustify fork at:
https://github.com/tianocore/uncrustify
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Runs the Black formatter against UncrustifyCheck.py so is formatted
to PEP-8. No functional changes are made.
https://pypi.org/project/black/
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
The plugin previously assumed that the workspace was a git repository
and made that pacakges would largely reside in that same repository.
A few changes are made to better support multi-repo workspaces:
1. Added a new method to find the git repo that contains the package
being checked: `_get_git_repo_path()`.
2. Removes exceptions on git not being present and ignore/submodule
exceptions.
3. Checks for git ignored files (and similar) in the repo containing
the package being checked in `_get_git_ignored_paths()`.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
https://codeql.github.com/codeql-query-help/cpp/cpp-comparison-with-wider-type
If the narrow type (smaller range) is compared against a wide type
(larger range), the narrow value may overflow before reaching the wide
value. This can cause unexpected behavior, such as:
Infinite loops (loop condition never becomes false).
Incorrect logic (comparison results are misleading).
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
https://github.com/github/codeql/blob/codeql-cli-2.7.3/cpp/ql/src/Security/CWE/CWE-457/ConditionallyUninitializedVariable.qhelp
Some local variables, when going through a code path, can
end up uninitialized (using the value they had at the start
of the function). This is generally due to an error path
that can occur based on the library instances, or the
unchecked error (i.e. a allocation failing).
These variables should be initialized with a known value
that will result in the function being able to exit
gracefully.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
https://codeql.github.com/codeql-query-help/cpp/cpp-comparison-with-wider-type
If the narrow type (smaller range) is compared against a wide type
(larger range), the narrow value may overflow before reaching the wide
value. This can cause unexpected behavior, such as:
Infinite loops (loop condition never becomes false).
Incorrect logic (comparison results are misleading).
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
https://codeql.github.com/codeql-query-help/cpp/cpp-comparison-with-wider-type
If the narrow type (smaller range) is compared against a wide type
(larger range), the narrow value may overflow before reaching the wide
value. This can cause unexpected behavior, such as:
Infinite loops (loop condition never becomes false).
Incorrect logic (comparison results are misleading).
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
Fix codeql reported issues by flattening MainCmdEfiDecompress(),
making it easier for the tool to evaluate potential risks.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Refactor the Comp command and extract 2 functions:
- OpenFileOperand()
- CompareFiles()
This allows to simplify the logic of MainCmdComp() and
fix some codeql reported potential errors.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Check the return value of LocateProtocol() before
using the decompression protocol. This avoids a
potential NULL pointer derefence spotted by codeql.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Extract file opening and compression code into helpers.
Upon calling:
- gEfiShellProtocol->GetFileSize()
- gEfiShellProtocol->ReadFile()
the returned Status is now checked.
Upon calling AllocateZeroPool, the failed status is now set to
EFI_OUT_OF_RESOURCES.
Other than that, no functional change.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- LoadPciRom.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- HexEdit/HexEdit.c
- LoadPciRom.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
If ShellCommandLineParse() fails, there is no need to free:
- InputStr
- Package
Remove the goto statement.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Package is sometimes initialized to NULL and only
freed if not NULL. Remove these as:
- Package is initialized in ShellCommandLineParse().
- If ShellCommandLineFreeVarList() is reached,
Package cannot be NULL.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- HexEdit/HexEdit.c
- LoadPciRom.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Package is always freed in ShellCommandRunLs().
Remove calls to ShellCommandLineFreeVarList() in MainCmdLs().
This double-free was introduced in:
commit 531b0aa002 ("ShellPkg/UefiShellLevel2:
Extract MainCmdXXX() function")
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
The commented out code snippet seems to try to create a new file
with the user input filename. FileBufferRead() seems to have replaced
this code snippet in a better wrapper:
- if the file exists, open it
- otherwise, create the file
Remove the commented-out code snippet.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Updated Tpm2DeviceLibFfa to no longer use globals. Updated the
SEC version of Tpm2DeviceLibFfaBase to no longer use globals
when including TPM libraries in the SEC phase. Includes various
cleanup regarding the updated files.
Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
The TcpDxe driver requires the Hash2 protocol to be available for its
dispatch. On the LoongArchVirt QEMU platform, this protocol was not
previously included, leading to failures when the network stack attempted
to initialize.
Add SecurityPkg/Hash2DxeCrypto to both the DSC and FDF files, ensuring
that the Hash2 protocol is installed and can be consumed by TcpDxe.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Use TPM 1.2 and TPM 2.0 in setup titles instead of the
implementation-facing TCG and TCG2 names.
Signed-off-by: Herve ELTER <rvnvv74@gmail.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
The libspdm submodule was pinned at 3.7.0 (2025-04-03), three releases behind
upstream 3.8.2 (2026-04-03). libspdm processes untrusted responder (device)
data in the SPDM device attestation path, so tracking upstream keeps that
parsing current with fixes and hardening.
Two responder-side advisories were resolved between 3.7.0 and 3.8.2:
- GHSA-j54w-759w-xj3m: out-of-bounds write in GET_CSR handling.
- GHSA-m4wc-xmvg-369f: integer overflow / out-of-bounds read in
GET_MEASUREMENT_EXTENSION_LOG handling.
Both are responder-side. edk2 links SpdmRequesterLib (it acts as the SPDM
Requester that verifies an untrusted device Responder), so these responder
handlers are not built into edk2 images; this update is defense-in-depth
rather than a fix for a path reachable in edk2 today.
The libspdm sources referenced by the SpdmLib INFs are unchanged in 3.8.2
(the only additions are the optional ENDPOINT_INFO capability sources, which
edk2 does not enable), so no INF change is required.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chris Fernald <chfernal@microsoft.com>
Signed-off-by: Mikey Strauss <mdstrauss91@gmail.com>
For each structured-PCD field copied via memcpy, DscBuildData.py
emits the clamp expression, '(FieldSize > 0 && FieldSize < ValueSize) ?
FieldSize : ValueSize'. When ValueSize == 1 and FieldSize is unsigned,
it reduces to (FieldSize > 0 && FieldSize < 1) - always-false comparison.
Clang flags it under -Wtautological-overlap-compare, and because
PcdValueInit builds with -Werror, autogen fails and the build aborts with
'PcdValueInit.c: error: overlapping comparisons always evaluate to false
[-Werror,-Wtautological-overlap-compare]'. This is specific to Clang host.
To fix it, this update changes '<' to '<=' at all five generator sites in
DscBuildData.py (GenerateDefaultValueAssignFunction,
GenerateInitValueFunction, GenerateCommandLineValue,
GenerateModuleScopeValue, GenerateFdfValue). Behavior is unchanged:
both branches copy the same byte count when FieldSize == ValueSize.
GCC and MSVC builds are unaffected.
Signed-off-by: Phil Noh <Phil.Noh@amd.com>
In TDX mode MmioRead* functions can not access memory, so avoid that.
See added source code comments for details.
Fixes: 0917ddad25 ("OvmfPkg/EmuVariableFvbRuntimeDxe: avoid accessing varstore header with cmp")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
TcpDxe depends on gEfiHash2ServiceBindingProtocolGuid, which nothing on
the platform produces, so it is built into the FV but never dispatched.
Add Hash2DxeCrypto, as ArmVirtQemu does. The rest of NetworkPkg depends
on gEfiRngProtocolGuid, produced by VirtioRngDxe when the VM is given a
virtio-rng device.
Signed-off-by: Nick Owens <mischief@offblast.org>
Fix CpuGetInterruptState() to read the actual hardware interrupt flag
(sstatus.SIE) via BaseLib's GetInterruptState() instead of returning a cached
boolean variable. The cached variable becomes stale in interrupt context
where hardware disables interrupts without going through the protocol's
DisableInterrupt() call.
This is a PI Spec conformance fix: EFI_CPU_ARCH_PROTOCOL.GetInterruptState()
is specified to return the current processor interrupt state.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Fix CpuGetInterruptState() to read the actual hardware interrupt flag
(RFLAGS.IF) via BaseLib's GetInterruptState() instead of returning a cached
boolean variable. The cached variable becomes stale in interrupt context
where hardware disables interrupts without going through the protocol's
DisableInterrupt() call.
This is a PI Spec conformance fix: EFI_CPU_ARCH_PROTOCOL.GetInterruptState()
is specified to return the current processor interrupt state.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>