Files
linux/samples
Gary Guo f5256ad606 samples: rust: debugfs: fix excessive stack use
The current implementation creates a 4K array and move it into the box.
Klint reports that this causes excesssive stack usage:

warning: stack size of `create_file_write` is 4472 bytes, exceeds the 2048-byte limit
  --> samples/rust/rust_debugfs_scoped.rs:54:1
   |
54 | / fn create_file_write(
55 | |     mod_data: &ModuleData,
56 | |     reader: &mut kernel::uaccess::UserSliceReader,
57 | | ) -> Result {
   | |___________^
   |
   = note: the stack size is inferred from instruction `sub $0x1178,%rsp` at .text+2205

Use pin-init to create the array in-place instead.

Fixes: f656279afd ("samples: rust: debugfs_scoped: add example for blobs")
Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260716144144.3665719-1-gary@kernel.org
[ Make the patch rustfmtcheck complient. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-21 00:48:25 +02:00
..
2024-05-04 18:59:44 +02:00
2026-03-19 10:57:15 -07:00