<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Tianocore/edk2.git/MdeModulePkg/Core/Dxe/Hand, branch master</title>
<subtitle>EDK II (mirror)</subtitle>
<id>https://git.radix-linux.su/Tianocore/edk2.git/atom?h=master</id>
<link rel='self' href='https://git.radix-linux.su/Tianocore/edk2.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/'/>
<updated>2026-03-23T18:43:11+00:00</updated>
<entry>
<title>MdeModulePkg/Core: Validate DXE event signature before usage</title>
<updated>2026-03-23T18:43:11+00:00</updated>
<author>
<name>Khalid Ali</name>
<email>khaliidcaliy@gmail.com</email>
</author>
<published>2026-03-04T14:53:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=260b91a352b870a6d7c05bdf47bd4564e7677c7c'/>
<id>urn:sha1:260b91a352b870a6d7c05bdf47bd4564e7677c7c</id>
<content type='text'>
fixes: #11112

Currently, function RegisterProtocolNotify() doesn't check the validity
of event and it accepts any event pointer as long as pointer isn't NULL.
However event could be closed and freed which could lead to use after
free.

Always check event signature before usage and return
EFI_INVALID_PARAMTER for events with invalid signature.

Signed-off-by: Khalid Ali &lt;khaliidcaliy@gmail.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg/Core: Increment handle key outside if block</title>
<updated>2026-03-09T09:19:06+00:00</updated>
<author>
<name>Khalid Ali</name>
<email>khaliidcaliy@gmail.com</email>
</author>
<published>2026-01-27T16:52:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=8f28978843f14deaa1b1060fbfd4983f82207506'/>
<id>urn:sha1:8f28978843f14deaa1b1060fbfd4983f82207506</id>
<content type='text'>
Fixes: #11113

Currently, the global handle key and key inside handle structure is
incremented only when a new handle is allocated for protocol interface
to be installed.

However, when caller already supplies a handle gHandleDatabaseKey never
get incremented.

Move handle key incremental outside if block, just below the else
statement which allows gHandleDatabaseKey to always incremented whether
handle is supplied or not.

Signed-off-by: Khalid Ali &lt;khaliidcaliy@gmail.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: 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:48:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=7a934d0befca7d10f361c76af6d2fcb6eb48c835'/>
<id>urn:sha1:7a934d0befca7d10f361c76af6d2fcb6eb48c835</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>MdeModulePkg: Fix missing NULL tests.</title>
<updated>2025-11-22T18:58:47+00:00</updated>
<author>
<name>Aaron Pop</name>
<email>aaronpop@microsoft.com</email>
</author>
<published>2025-10-22T18:33:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=5214f931c9a9bed62e1d5324864c60f25b77590d'/>
<id>urn:sha1:5214f931c9a9bed62e1d5324864c60f25b77590d</id>
<content type='text'>
https://github.com/github/codeql/blob/codeql-cli-2.7.3/cpp/ql/src/Critical/MissingNullTest.qhelp

For items which allocate memory, or get a pointer from another
structure, it is important to validate that the pointers
are not null before they are dereferenced.

Signed-off-by: Aaron Pop &lt;aaronpop@microsoft.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: fix warning about uninitialized variable</title>
<updated>2025-01-29T16:20:57+00:00</updated>
<author>
<name>Mike Maslenkin</name>
<email>mike.maslenkin@gmail.com</email>
</author>
<published>2025-01-09T18:05:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=0f12a5f722cee18b55de291d3e4bc9b4248ba9b8'/>
<id>urn:sha1:0f12a5f722cee18b55de291d3e4bc9b4248ba9b8</id>
<content type='text'>
Handle.c:1302:24: error: 'Prot' may be used uninitialized
  in this function [-Werror=maybe-uninitialized]

       *Interface = Prot-&gt;Interface;
                    ~~~~^~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Mike Maslenkin &lt;mike.maslenkin@gmail.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: CoreValidateHandle Optimization</title>
<updated>2024-08-30T11:42:41+00:00</updated>
<author>
<name>Xiaoqiang Zhang</name>
<email>xiaoqiang.zhang@intel.com</email>
</author>
<published>2024-08-07T08:42:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=0596e5fa05a7badb30fb3d4092d41a787788655c'/>
<id>urn:sha1:0596e5fa05a7badb30fb3d4092d41a787788655c</id>
<content type='text'>
REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4817

Before entering BIOS setup, CoreValidateHandle function executed
over 600,000 times during BDS phase on latest 8S server platform.
In CoreValidateHandle function, current implementation will go
through the doubly-linked list handle database in each call, and
this will have big impact on boot performance.
The optimization is using Red-black tree to store the EFI handle
address when insert each EFI handle into the handle database, and
remove the handle from Red-black tree if the handle is removed
from the handle database. CoreValidateHandle function changed to
go through the Red-black tree.
After verification on latest 8S server platform, BDS boot time can
save 20s+ after this change.

Cc: Ray Ni &lt;ray.ni@intel.com&gt;
Cc: Star Zeng &lt;star.zeng@intel.com&gt;
Cc: Liming Gao &lt;gaoliming@byosoft.com.cn&gt;
Signed-off-by: Andrew Fish &lt;afish@apple.com&gt;
Tested-by: Xiaoqiang Zhang &lt;xiaoqiang.zhang@intel.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: Optimize CoreConnectSingleController</title>
<updated>2024-02-06T17:54:53+00:00</updated>
<author>
<name>Zhi Jin</name>
<email>zhi.jin@intel.com</email>
</author>
<published>2024-01-15T08:56:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=959f71c801b447186413532166d3fb2ad9a590da'/>
<id>urn:sha1:959f71c801b447186413532166d3fb2ad9a590da</id>
<content type='text'>
CoreConnectSingleController() searches for the Driver Family Override
Protocol drivers by looping and checking each Driver Binding Handles.
This loop can be skipped by checking if any Driver Family Override
Protocol installed in the platform first, to improve the performance.

Cc: Ray Ni &lt;ray.ni@intel.com&gt;
Reviewed-by: Liming Gao &lt;gaoliming@byosoft.com.cn&gt;
Reviewed-by: Michael D Kinney &lt;michael.d.kinney@intel.com&gt;
Signed-off-by: Zhi Jin &lt;zhi.jin@intel.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: Remove handle validation check in CoreGetProtocolInterface</title>
<updated>2024-02-06T17:54:53+00:00</updated>
<author>
<name>Zhi Jin</name>
<email>zhi.jin@intel.com</email>
</author>
<published>2024-01-15T07:17:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=9eddbab65042259beb1a75ccdf724996eab9660d'/>
<id>urn:sha1:9eddbab65042259beb1a75ccdf724996eab9660d</id>
<content type='text'>
CoreGetProtocolInterface() is called by CoreOpenProtocol(),
CoreCloseProtocol() and CoreOpenProtocolInformation().
Before CoreOpenProtocol() calls CoreGetProtocolInterface(), the input
parameter UserHandle has been already checked for validation. So does
CoreCloseProtocol().
Removing the handle validation check in CoreGetProtocolInterface()
could improve the performance, as CoreOpenProtocol() is called very
frequently.
To ensure the assumption that the caller of CoreGetProtocolInterface()
must pass in a valid UserHandle that is checked with CoreValidateHandle(),
add the parameter check in CoreOpenProtocolInformation(), and declare
CoreGetProtocolInterface() as static.

Reviewed-by: Ray Ni &lt;ray.ni@intel.com&gt;
Reviewed-by: Liming Gao &lt;gaoliming@byosoft.com.cn&gt;
Reviewed-by: Michael D Kinney &lt;michael.d.kinney@intel.com&gt;
Signed-off-by: Zhi Jin &lt;zhi.jin@intel.com&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: Optimize CoreInstallMultipleProtocolInterfaces</title>
<updated>2023-12-01T00:53:56+00:00</updated>
<author>
<name>Zhi Jin</name>
<email>zhi.jin@intel.com</email>
</author>
<published>2023-11-08T02:39:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=534021965f6f7c417610add53984f39d6945bbcf'/>
<id>urn:sha1:534021965f6f7c417610add53984f39d6945bbcf</id>
<content type='text'>
CoreLocateDevicePath is used in CoreInstallMultipleProtocolInterfaces to
check if a Device Path Protocol instance with the same device path is
alreay installed.
CoreLocateDevicePath is a generic API, and would introduce some
unnecessary overhead for such usage.

The optimization is:
1. Implement IsDevicePathInstalled to loop all the Device Path
   Protocols installed and check if any of them matchs the given device
   path.
2. Replace CoreLocateDevicePath with IsDevicePathInstalled in
   CoreInstallMultipleProtocolInterfaces.

This optimization could save several seconds in PCI enumeration on a
system with many PCI devices.

Cc: Jian J Wang &lt;jian.j.wang@intel.com&gt;
Cc: Liming Gao &lt;gaoliming@byosoft.com.cn&gt;
Cc: Dandan Bi &lt;dandan.bi@intel.com&gt;
Cc: Ray Ni &lt;ray.ni@intel.com&gt;
Signed-off-by: Zhi Jin &lt;zhi.jin@intel.com&gt;
Reviewed-by: Ray Ni &lt;ray.ni@intel.com&gt;
Reviewed-by: Liming Gao &lt;gaoliming@byosoft.com.cn&gt;
</content>
</entry>
<entry>
<title>MdeModulePkg: Fix memory leak in LocateHandleBuffer()</title>
<updated>2023-08-31T19:35:19+00:00</updated>
<author>
<name>Nate DeSimone</name>
<email>nathaniel.l.desimone@intel.com</email>
</author>
<published>2023-08-30T14:51:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=beafabdae49c873adecdb7511dbebe9d4ff5c8f0'/>
<id>urn:sha1:beafabdae49c873adecdb7511dbebe9d4ff5c8f0</id>
<content type='text'>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4543
REF: https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#efi-boot-services-locatehandlebuffer

CoreLocateHandleBuffer() can in certain cases, return an
error and not free an allocated buffer. This scenario
occurs if the first call to InternalCoreLocateHandle()
returns success and the second call returns an error.

On a successful return, LocateHandleBuffer() passes
ownership of the buffer to the caller. However, the UEFI
specification is not explicit about what the expected
ownership of this buffer is in the case of an error.
However, it is heavily implied by the code example given
in section 7.3.15 of v2.10 of the UEFI specificaton that
if LocateHandleBuffer() returns a non-successful status
code then the ownership of the buffer does NOT transfer
to the caller. This code example explicitly refrains from
calling FreePool() if LocateHandleBuffer() returns an
error.

From a practical standpoint, it is logical to assume that
a non-successful status code indicates that no buffer of
handles was ever allocated. Indeed, in most error cases,
LocateHandleBuffer() does not go far enough to get to the
point where a buffer is allocated. Therefore, all existing
users of this API must already be coded to support the case
of a non-successful status code resulting in an invalid
handle buffer being returned. Therefore, this change will
not cause any backwards compatibility issues with existing
code.

In conclusion, this boils down to a fix for a memory leak
that also brings the behavior of our LocateHandleBuffer()
implementation into alignment with the original intentions
of the UEFI specification authors.

Reviewed-by: Michael D Kinney &lt;michael.d.kinney@intel.com&gt;
Cc: Liming Gao &lt;gaoliming@byosoft.com.cn&gt;
Cc: Jian J Wang &lt;jian.j.wang@intel.com&gt;
Cc: Dandan Bi &lt;dandan.bi@intel.com&gt;
Signed-off-by: Nate DeSimone &lt;nathaniel.l.desimone@intel.com&gt;
</content>
</entry>
</feed>
