Skip to content
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

Fix memory initialization bug in cxplat winkernel #108

Merged
merged 2 commits into from
Aug 31, 2023
Merged

Fix memory initialization bug in cxplat winkernel #108

merged 2 commits into from
Aug 31, 2023

Conversation

dthaler
Copy link
Contributor

@dthaler dthaler commented Aug 31, 2023

ExAllocatePoolWithTag does not zero-initialize memory

ExAllocatePoolWithTag does not zero-initialize memory

Signed-off-by: Dave Thaler <[email protected]>
Signed-off-by: Dave Thaler <[email protected]>
@dthaler dthaler merged commit c40d7ff into main Aug 31, 2023
@dthaler dthaler deleted the memory branch August 31, 2023 19:00
@@ -7,12 +7,11 @@
__drv_allocatesMem(Mem) _Must_inspect_result_ _Ret_writes_maybenull_(size) void* cxplat_allocate_with_tag(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have one function with a flag, requiring that extra branch for every caller? I'd expect most callers to always pick one or the other, so if you had two functions, you'd never need a branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, though once #90 is done it will be moot as compiler optimization will remove the unused branch.
Still, probably good to split in the future, the code has been this way in ebpf-for-windows and just moved here, but can clean up going forward.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the compiler should do a good job and optimize it away, but I never have much faith in compiler optimizations. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants