diff options
| author | Sami Tolvanen <samitolvanen@google.com> | 2026-10-19 23:34:39 +0000 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-10-22 15:36:01 +0200 |
| commit | 7d109178cd644268326cd31702ed46c7ac8bb300 (patch) | |
| tree | 57575644d2801995773d227c64ce3160a7bd4fe8 /rust/bindgen_parameters | |
| parent | 39fe6892fd52faed6325ff7f13a92da01ab35727 (diff) | |
rust: dma: declare cfi_encoding for dma_data_direction
bindgen generates bindings::dma_data_direction as an integer by default,
while C callback tables such as dma_buf_ops declare the parameter as
enum dma_data_direction. kCFI encodes enum types by name even with
integer normalization, so the type ids would not match when C calls into
a Rust callback taking bindings::dma_data_direction.
Generate dma_data_direction as a newtype with a cfi_encoding, as is done
for lru_status, and convert DataDirection through the newtype's
constants.
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Cc: stable@vger.kernel.org
Fixes: c2437c43cfb1 ("rust: dma: implement DataDirection")
Link: https://patch.msgid.link/20261019-rust-cfi-fixes-v1-3-9503472ba738@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/bindgen_parameters')
| -rw-r--r-- | rust/bindgen_parameters | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/bindgen_parameters b/rust/bindgen_parameters index 6003d5127676..8577e7663e02 100644 --- a/rust/bindgen_parameters +++ b/rust/bindgen_parameters @@ -27,6 +27,8 @@ --opaque-type spinlock # enums that appear in indirect function calls should specify a cfi type +--newtype-enum dma_data_direction +--with-attribute-custom-enum=dma_data_direction='#[cfi_encoding="18dma_data_direction"]' --newtype-enum hrtimer_restart --with-attribute-custom-enum=hrtimer_restart='#[cfi_encoding="15hrtimer_restart"]' --newtype-enum irqreturn |
