Skip to content

Commit

Permalink
Added codeql fixes to DxeCorePerformanceLib.c (#636)
Browse files Browse the repository at this point in the history
## Description

Addressed some codeql errors in DxeCorePerformanceLib.c. Nothing
functionally has changed as a null module name being returned is being
accounted for already.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Tested on an intel physical platform.

## Integration Instructions

N/A
  • Loading branch information
kenlautner authored Dec 1, 2023
1 parent f9da941 commit fa2c75b
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,13 @@ InsertFpdtRecord (
switch (PerfId) {
case MODULE_START_ID:
case MODULE_END_ID:
GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
// MU_CHANGE [BEGIN] - CodeQL change
Status = GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Module Info from Handle! Status = %r\n", Status));
}

// MU_CHANGE [END] - CodeQL change
StringPtr = ModuleName;
//
// Cache the offset of start image start record and use to update the start image end record if needed.
Expand Down Expand Up @@ -1083,7 +1089,13 @@ InsertFpdtRecord (

case MODULE_LOADIMAGE_START_ID:
case MODULE_LOADIMAGE_END_ID:
GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
// MU_CHANGE [BEGIN] - CodeQL change
Status = GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Module Info from Handle! Status = %r\n", Status));
}

// MU_CHANGE [END] - CodeQL change
StringPtr = ModuleName;
if (PerfId == MODULE_LOADIMAGE_START_ID) {
mLoadImageCount++;
Expand Down Expand Up @@ -1126,7 +1138,13 @@ InsertFpdtRecord (
case MODULE_DB_SUPPORT_END_ID:
case MODULE_DB_STOP_START_ID:
case MODULE_DB_STOP_END_ID:
GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
// MU_CHANGE [BEGIN] - CodeQL change
Status = GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Module Info from Handle! Status = %r\n", Status));
}

// MU_CHANGE [END] - CodeQL change
StringPtr = ModuleName;
if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
FpdtRecordPtr.GuidQwordEvent->Header.Type = FPDT_GUID_QWORD_EVENT_TYPE;
Expand All @@ -1141,7 +1159,13 @@ InsertFpdtRecord (
break;

case MODULE_DB_END_ID:
GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
// MU_CHANGE [BEGIN] - CodeQL change
Status = GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get Module Info from Handle! Status = %r\n", Status));
}

// MU_CHANGE [END] - CodeQL change
StringPtr = ModuleName;
if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
FpdtRecordPtr.GuidQwordStringEvent->Header.Type = FPDT_GUID_QWORD_STRING_EVENT_TYPE;
Expand Down

0 comments on commit fa2c75b

Please sign in to comment.