Skip to content

OvmfPkg/PlatformDebugLibIoPort: Add check for MemDebugLogWrite #11239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 8, 2025

Conversation

luigix25
Copy link
Contributor

This check is present for every call to MemDebugLogWrite but it is missing here. This may cause an unwanted write to the buffer, when the buffer's address is not null and MemDebug is disabled.

Description

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

<Describe the test(s) that were run to verify the changes.>

Integration Instructions

<Describe how these changes should be integrated. Use N/A if nothing is required.>

This check is present for every call to `MemDebugLogWrite` but it is
missing here. This may cause an unwanted write to the
buffer, when the buffer's address is not null and MemDebug is disabled.

Signed-off-by: Luigi Leonardi <[email protected]>
@ajyoung-oracle
Copy link
Contributor

ajyoung-oracle commented Jun 30, 2025

This change is technically not needed (i.e. it's not a BUG) because the MemDebugLogNull implementation of MemDebugLogWrite() is a NOP. The only reason we added MemDebugLogEnabled() is it to allow DebugPrintMarker() to be optimized to bypass the string formatting. But, it doesn't hurt to add the extra call in DebugAssert() as well. Just FYI...

@luigix25
Copy link
Contributor Author

luigix25 commented Jul 1, 2025

Thanks for the information! I guess I have to change the commit message. I'll leave it up to the maintainers to decide whether or not to merge this.

@ardbiesheuvel ardbiesheuvel added the push Auto push patch series in PR if all checks pass label Jul 8, 2025
@mergify mergify bot merged commit fb55173 into tianocore:master Jul 8, 2025
130 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants