diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2024-09-10 13:49:53 +0200 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2024-09-10 13:49:53 +0200 |
| commit | 2f7eedca6cecbfad52d5b52c1550066d9252c947 (patch) | |
| tree | ffce8be3ceee2c845a951d11b99578ca468639a4 /rust/kernel/alloc | |
| parent | treewide: Fix wrong singular form of jiffies in comments (diff) | |
| parent | Linux 6.11-rc7 (diff) | |
| download | linux-2f7eedca6cecbfad52d5b52c1550066d9252c947.tar.gz linux-2f7eedca6cecbfad52d5b52c1550066d9252c947.zip | |
Merge branch 'linus' into timers/core
To update with the latest fixes.
Diffstat (limited to 'rust/kernel/alloc')
| -rw-r--r-- | rust/kernel/alloc/box_ext.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rust/kernel/alloc/box_ext.rs b/rust/kernel/alloc/box_ext.rs index 829cb1c1cf9e..9f1c1c489189 100644 --- a/rust/kernel/alloc/box_ext.rs +++ b/rust/kernel/alloc/box_ext.rs @@ -21,8 +21,10 @@ pub trait BoxExt<T>: Sized { impl<T> BoxExt<T> for Box<T> { fn new(x: T, flags: Flags) -> Result<Self, AllocError> { - let b = <Self as BoxExt<_>>::new_uninit(flags)?; - Ok(Box::write(b, x)) + let mut b = <Self as BoxExt<_>>::new_uninit(flags)?; + b.write(x); + // SAFETY: We just wrote to it. + Ok(unsafe { b.assume_init() }) } #[cfg(any(test, testlib))] |
