<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Tianocore/edk2.git/EmbeddedPkg/Library/PrePiLib, branch dependabot/github_actions/github/codeql-action-4.39.3</title>
<subtitle>EDK II (mirror)</subtitle>
<id>https://git.radix-linux.su/Tianocore/edk2.git/atom?h=dependabot%2Fgithub_actions%2Fgithub%2Fcodeql-action-4.39.3</id>
<link rel='self' href='https://git.radix-linux.su/Tianocore/edk2.git/atom?h=dependabot%2Fgithub_actions%2Fgithub%2Fcodeql-action-4.39.3'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/'/>
<updated>2026-11-02T03:24:56+00:00</updated>
<entry>
<title>EmbeddedPkg/PrePiLib: drop DstBuffer adjustment in FfsProcessSection</title>
<updated>2026-11-02T03:24:56+00:00</updated>
<author>
<name>Ming Huang</name>
<email>huangming@linux.alibaba.com</email>
</author>
<published>2026-10-23T04:05:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=496fd85f26d40871c97c5835bf5ed849b6eb8a70'/>
<id>urn:sha1:496fd85f26d40871c97c5835bf5ed849b6eb8a70</id>
<content type='text'>
The DstBuffer adjustment in FfsProcessSection() was added in the
BeagleBoard era (2ef2b01e07), when the decompressed section stream
placed the encapsulated section data directly after the 4/8 byte
EFI_COMMON_SECTION_HEADER. Bumping DstBuffer forward by
EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER) put the section
data back on a page boundary at the cost of one extra page.

For FV images this compensation is obsolete and harmful:

- GenFds aligns the FV_IMAGE section data inside the stream to the
  FvAlignment recorded in the inner FV header, by emitting a RAW pad
  section in front of the FV_IMAGE section. With a page aligned
  DstBuffer, the decompressed FV therefore already starts at a
  FvAlignment-aligned offset (e.g. DstBuffer + 0x10 for a typical
  FvAlignment = 16 build).

- The forward bump instead moves the FV to
  DstBuffer + EFI_PAGE_SIZE - sizeof (EFI_COMMON_SECTION_HEADER) + pad,
  which is 12 bytes off for FvAlignment = 16. FfsProcessFvFile() then
  takes its misalignment fallback and AllocateAlignedPages() a second
  buffer to CopyMem() the entire FV, doubling the temporary RAM
  footprint of the decompressed DXEFV.

On platforms with a modest SEC temporary RAM pool this is fatal: a
RISC-V platform with a 16 MiB pool and a ~9 MiB LZMA compressed DXEFV
fails to boot with EFI_OUT_OF_RESOURCES from DecompressFirstFv(),
because the redundant aligned copy no longer fits. The same FDF
pattern (FvAlignment = 16 DXEFV wrapped in the LZMA GUIDED section)
is used by OvmfPkg/RiscVVirt, which gets away with it only because
of its more generous memory layout, and pays a full extra copy of
the FV on every boot.

Remove the adjustment, and the extra page that was reserved for it,
so the decompressed FV keeps its natural, build-time guaranteed
alignment. Verified on the affected RISC-V platform: the FV now
lands 16-byte aligned, the fallback copy is not taken, and boot
succeeds in both RELEASE and DEBUG builds.

Cc: Leif Lindholm &lt;leif.lindholm@oss.qualcomm.com&gt;
Cc: Ard Biesheuvel &lt;ardb+tianocore@kernel.org&gt;
Cc: Abner Chang &lt;abner.chang@amd.com&gt;
Signed-off-by: Ming Huang &lt;huangming@linux.alibaba.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg: PrePiLib: Fix uninitialized variable warnings</title>
<updated>2026-06-24T14:49:50+00:00</updated>
<author>
<name>Tuan Phan</name>
<email>tuan.phan@oss.qualcomm.com</email>
</author>
<published>2026-01-21T04:15:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=b3d5f2b349041fedc31b0ff1fd4b3719bed33923'/>
<id>urn:sha1:b3d5f2b349041fedc31b0ff1fd4b3719bed33923</id>
<content type='text'>
In FfsProcessSection(), delete CompressionSectionHeaderSize and move
CompressedData to avoid the compiler warning without changing functional
behavior.

Signed-off-by: Tuan Phan &lt;tuan.phan@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg, OvmfPkg: Produce FV3 HOBs for Extracted FVs</title>
<updated>2026-06-13T09:06:33+00:00</updated>
<author>
<name>Oliver Smith-Denny</name>
<email>osde@microsoft.com</email>
</author>
<published>2026-06-12T14:50:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=c6c02f8cae2642b9a8987ef14b1606afb0688b1e'/>
<id>urn:sha1:c6c02f8cae2642b9a8987ef14b1606afb0688b1e</id>
<content type='text'>
EmbeddedPkg's PrePiLib and OvmfPkg's PeilessStartupLib (which
uses PrePiLib) only produce FV2 HOBs for extracted FVs. However,
FV3 HOBs have superceded FV2 HOBs for describing extracted FVs.

This commit updates both of these libs to also produce FV3 HOBs,
following PEI's pattern of producing an FV, FV2, and FV3 HOB for
each extracted FV.

Eventually, only FV3 HOBs will be produced, so this paves the way
for that.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny &lt;osde@microsoft.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg, OvmfPkg: PrePiLib: Use Correct FvName in FV2 HOB Production</title>
<updated>2026-06-13T09:06:33+00:00</updated>
<author>
<name>Dmitry Antipov</name>
<email>dmanti@microsoft.com</email>
</author>
<published>2019-08-12T22:57:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=7ad30b28b2e86ccc9cab9917d272f486140323bb'/>
<id>urn:sha1:7ad30b28b2e86ccc9cab9917d272f486140323bb</id>
<content type='text'>
PrePiLib is incorrectly producing FV2 HOBs. The FvName field of
the FV2 HOB is intended to be the parent FV's name. This way the
HOB consumer phase can identify when an FV has already been
extracted: if the file name of the extracted FV and the parent
FV name match in the FV2 HOB.

With the incorrect FvName, DXE will re-extract the already
extracted FV, which can be a large performance hit (some platforms
we have seen ~1 second).

This requires an update to FfsProcessFvFile to pass the parent
FV handle through so the FV2 HOB can be correctly produced.
OvmfPkg consumers are also updated.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny &lt;osde@microsoft.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg: PrePiLib: Zero Volume Info Buffer Before Writing</title>
<updated>2026-06-13T09:06:33+00:00</updated>
<author>
<name>Oliver Smith-Denny</name>
<email>osde@microsoft.com</email>
</author>
<published>2026-06-12T21:53:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=6eca4a4a95942e9d7eb1809524e4116fb3ac1cd3'/>
<id>urn:sha1:6eca4a4a95942e9d7eb1809524e4116fb3ac1cd3</id>
<content type='text'>
FfsGetVolumeInfo() in PrePiLib does not zero the VolumeInfo
buffer before writing to it. However, it has some fields that
are expected to be zero if certain conditions are not met.

For example, the FvName is expected to be all 0's if the
extended header is not present in the FV. Currently,
the FvName field will point to garbage if the caller does
not zero the buffer first.

Flip the expectation and have FfsGetVolumeInfo() zero the
buffer before it writes to it.

Signed-off-by: Oliver Smith-Denny &lt;osde@microsoft.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg: PrePiLib: Skip Extracting if FV3 HOB Found</title>
<updated>2026-06-13T09:06:33+00:00</updated>
<author>
<name>Oliver Smith-Denny</name>
<email>osde@microsoft.com</email>
</author>
<published>2026-06-12T14:48:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=e63bba000a464fe35fb215e99bc4dcf01ebeabd6'/>
<id>urn:sha1:e63bba000a464fe35fb215e99bc4dcf01ebeabd6</id>
<content type='text'>
PrePiLib only searches for the existence of an FV2 HOB to
determine if an FV has already been extracted. However,
FV2 HOBs have been superceded by FV3 HOBs for describing extracted
FVs.

This commit updates PrePiLib to check for the existence of either
an FV2 or FV3 HOB for this FV and skips extracting if either is
found.

Signed-off-by: Oliver Smith-Denny &lt;osde@microsoft.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg: PrePi.h: Drop Duplicate HOB Defintions</title>
<updated>2026-06-13T09:06:33+00:00</updated>
<author>
<name>Oliver Smith-Denny</name>
<email>osde@microsoft.com</email>
</author>
<published>2026-06-12T14:34:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=622a2c7abf98d36525f8122ae724d381148121df'/>
<id>urn:sha1:622a2c7abf98d36525f8122ae724d381148121df</id>
<content type='text'>
PrePi.h has some duplicate HOB definitions from HobLib.h.
Instead of redefining them, use HobLib.h.

Signed-off-by: Oliver Smith-Denny &lt;osde@microsoft.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg/PrePiLib: Prevent overread with FFS size macros</title>
<updated>2026-04-13T14:12:17+00:00</updated>
<author>
<name>Gowtham M</name>
<email>gowthamm@ami.com</email>
</author>
<published>2025-11-04T06:37:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=3b0deb5e7941f59b0a262a4ed8a928f0d2dcb0da'/>
<id>urn:sha1:3b0deb5e7941f59b0a262a4ed8a928f0d2dcb0da</id>
<content type='text'>
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access

RootCause: FileSize and FileLength are declared as
UINT32 and masked with 0x00FFFFFF to store only the lower 24 bits.
Although this approach yields the correct result,
it introduces a potential risk due to unsafe typecasting and
dereferencing.

Solution: Using the predefined macro FFS_FILE_SIZE()
from MdePkg\Include\Pi\PiFirmwareFile.h,
which safely performs the same operation by reconstructing
the size using individual byte access.

This commit also addresses the fix for coverity isssue "OVERRUN"

Cc: Sachin Ganesh &lt;sachinganesh@ami.com&gt;
Signed-off-by: Gowtham M &lt;gowthamm@ami.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg: Replace include guards with #pragma once</title>
<updated>2026-02-23T21:01:28+00:00</updated>
<author>
<name>Michael Kubacki</name>
<email>michael.kubacki@microsoft.com</email>
</author>
<published>2026-02-03T18:18:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=de527ff60653a3ed7cf0e313695267b53c120a09'/>
<id>urn:sha1:de527ff60653a3ed7cf0e313695267b53c120a09</id>
<content type='text'>
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.

`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.

Compared to macro-based include guards, `#pragma once`:

- Eliminates the risk of macro name collisions or copy/paste errors
  where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
  (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
  file entirely, rather than re-reading it to find the matching
  `#endif` ("multiple-include optimization").
  - Note that some compilers may already optimize traditional include
    guards, by recognzining the idiomatic pattern.

This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.

However, this is considered acceptable given:

1. edk2 already defines a subset of supported compilers in
   BaseTools/Conf/tools_def.template, all of which have supported
   `#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
   include guard naming and potential macro collisions.

Approximate compiler support dates:

- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
  (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007

Signed-off-by: Michael Kubacki &lt;michael.kubacki@microsoft.com&gt;
</content>
</entry>
<entry>
<title>EmbeddedPkg/PrePiLib: minor cleanup in FfsProcessSection ()</title>
<updated>2025-09-11T21:05:29+00:00</updated>
<author>
<name>Leif Lindholm</name>
<email>leif.lindholm@oss.qualcomm.com</email>
</author>
<published>2025-07-10T11:39:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=615e5ca40a0d47d5381bda57821ca8aa1e821b0a'/>
<id>urn:sha1:615e5ca40a0d47d5381bda57821ca8aa1e821b0a</id>
<content type='text'>
Drop an else wrapper in FfsProcessSection () on the other side of
an if-statemenmt that is an error return.

Signed-off-by: Leif Lindholm &lt;leif.lindholm@oss.qualcomm.com&gt;
</content>
</entry>
</feed>
