Skip to content

Commit

Permalink
rust: helpers: remove guard for rust-bindgen bug
Browse files Browse the repository at this point in the history
On 32-bit arm, `size_t` and 'uintptr_t` are incompatible,
which will trigger the static assertion.

The bug which this guard protects against
(rust-lang/rust-bindgen#1671)
was fixed upstream as of rust-bindgen v0.53:
rust-lang/rust-bindgen#1688
d650823839f7 ("Remove size_t to usize conversion")

The current recommended rust-bindgen version for building
the Linux kernel is v0.56, so the guard can be safely
dropped.

Out of an abundance of caution, remove the guard only
if building for 32-bit arm.

Signed-off-by: Sven Van Asbroeck <[email protected]>
[normalized title]
Signed-off-by: Miguel Ojeda <[email protected]>
  • Loading branch information
Sven Van Asbroeck authored and ojeda committed Apr 27, 2021
1 parent 52a5564 commit b5a88a2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rust/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ void rust_helper_kunmap(struct page *page)
}
EXPORT_SYMBOL_GPL(rust_helper_kunmap);

#if !defined(CONFIG_ARM)
// See https://github.com/rust-lang/rust-bindgen/issues/1671
static_assert(__builtin_types_compatible_p(size_t, uintptr_t),
"size_t must match uintptr_t, what architecture is this??");
#endif

0 comments on commit b5a88a2

Please sign in to comment.