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 reference to packed field is unaligned #4

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

haata
Copy link

@haata haata commented Aug 30, 2022

error: reference to packed field is unaligned
--> src/codec.rs:187:35
|
187 | let payload = &event.u.start;
| ^^^^^^^^^^^^^^
|
= note: #[deny(unaligned_references)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 rust-lang/rust#82523
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use read_unaligned/write_unaligned (loads and stores via *p must be properly aligned even when using raw pointers)

src/codec.rs Outdated Show resolved Hide resolved
error: reference to packed field is unaligned
   --> src/codec.rs:187:35
    |
187 |                     let payload = &event.u.start;
    |                                   ^^^^^^^^^^^^^^
    |
    = note: `#[deny(unaligned_references)]` on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #82523 <rust-lang/rust#82523>
    = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
    = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
@haata haata force-pushed the fix_unaligned_access branch from 8e6d966 to d146f2c Compare October 6, 2022 05:45
archlinux-github pushed a commit to archlinux/aur that referenced this pull request Apr 26, 2023
Add some interim patches to get this building with the latest version of
cargo/rust. This is messy and will be dropped as soon as the
corresponding upstream PR is accepted [1].

Why is the patch bumping the uhid-virt version? Because the version
published to crates.io doesn't match the upstream package version,
despite the actual contents of the crate being the same. Feel free to
verify this [2].

[1] flukejones/uhid-virt#4
[2] https://static.crates.io/crates/uhid-virt/uhid-virt-0.0.5.crate

Signed-off-by: StaticRocket <35777938+StaticRocket@users.noreply.github.com>
@StaticRocket
Copy link

@flukejones , heads up, this will become relevant to your prioritized users soon [1].
Please review when you get a chance.

Also, the package version captured in this repo does not match the package version published on crates.io [2].

[1] https://doc.rust-lang.org/error_codes/E0793.html
[2] https://crates.io/crates/uhid-virt

@flukejones flukejones merged commit e66eb67 into flukejones:master Apr 26, 2023
archlinux-github pushed a commit to archlinux/aur that referenced this pull request Apr 26, 2023
Relevant uhid-virt PR got merged[1]. Drop interim patches.

This reverts commit aca6f4c.

[1] flukejones/uhid-virt#4
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