Skip to content

Add allocating get_info helper function #89

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
Feb 5, 2019

Conversation

josephlr
Copy link
Contributor

@josephlr josephlr commented Feb 5, 2019

Fixes #85

This helper function calls get_info twice (first to get the size, second to get the data). It handles error checking and correctly aligning the data buffer.

Note that this on top of #88, so that should be merged first.

@josephlr
Copy link
Contributor Author

josephlr commented Feb 5, 2019

I had to change some of the other alignment code to get everything else working. Specifically, we no longer check alignment for zero sized buffers (as it is not necessary). We also sometimes have to pass more data than is strictly necessary to handle the fact that UEFI doesn't request memory for end-of-struct padding.

@GabrielMajeri GabrielMajeri merged commit 954a359 into rust-osdev:master Feb 5, 2019
@josephlr josephlr deleted the fs-ext branch February 5, 2019 22:15
josephlr added a commit to josephlr/uefi-rs that referenced this pull request Feb 6, 2019
The change in rust-osdev#89 did not properly handle allocation failures. On
failure, alloc() returns a null pointer, and this is not checked.

This change moves buffer allocation to the new Alloc API, and correctly
handles allocation failure and potential unsafety with zero-sized alloc
requests.

I also removed the dependancy on uefi-services from uefi-alloc. The
dependancy isn't needed, and now users can use uefi-exts with their
own allocators.
josephlr added a commit to josephlr/uefi-rs that referenced this pull request Feb 6, 2019
The change in rust-osdev#89 did not properly handle allocation failures. On
failure, alloc() returns a null pointer, and this is not checked.

This change moves buffer allocation to the new Alloc API, and correctly
handles allocation failure and potential unsafety with zero-sized alloc
requests.

I also removed the dependancy on uefi-services from uefi-alloc. The
dependancy isn't needed, and now users can use uefi-exts with their
own allocators.
josephlr added a commit to josephlr/uefi-rs that referenced this pull request Feb 6, 2019
The change in rust-osdev#89 did not properly handle allocation failures. On
failure, alloc() returns a null pointer, and this is not checked.

This change moves buffer allocation to the new Alloc API, correctly
handles allocation failure, and avoids potential unsafety with
zero-sized alloc requests.

I also removed the dependancy on uefi-services from uefi-alloc. The
dependancy isn't needed, and now users can use uefi-exts with their
own allocators.
GabrielMajeri pushed a commit that referenced this pull request Feb 6, 2019
The change in #89 did not properly handle allocation failures. On
failure, alloc() returns a null pointer, and this is not checked.

This change moves buffer allocation to the new Alloc API, correctly
handles allocation failure, and avoids potential unsafety with
zero-sized alloc requests.

I also removed the dependancy on uefi-services from uefi-alloc. The
dependancy isn't needed, and now users can use uefi-exts with their
own allocators.
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.

2 participants