From c64d8a05481fa81d11cc84714a7e42bce1142050 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Mon, 21 Jul 2025 19:26:23 +0200 Subject: [PATCH] nouveau/headers: Fix nv_push rust push_inline_data implementation Signed-off-by: Mary Guillemard Fixes: 66954d997d8 ("nouveau/headers: Add an nv_push crate in Rust") Part-of: --- src/nouveau/headers/nv_push_rs/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nouveau/headers/nv_push_rs/lib.rs b/src/nouveau/headers/nv_push_rs/lib.rs index 1cb4a49ff8c..7f823b6771e 100644 --- a/src/nouveau/headers/nv_push_rs/lib.rs +++ b/src/nouveau/headers/nv_push_rs/lib.rs @@ -207,7 +207,10 @@ impl Push { /// Push an array of dwords into the push buffer pub fn push_inline_data(&mut self, data: &[u32]) { - if self.last_inc != usize::MAX { + if let Some(last) = self.mem.get_mut(self.last_inc) { + let last = MthdHeader::from_bits_mut(last); + last.add_len(data.len().try_into().unwrap()); + } else { panic!("Inline data must only be placed after a method header"); } self.mem.extend_from_slice(data);