diff options
author | Simona Vetter <simona.vetter@ffwll.ch> | 2024-09-11 09:18:15 +0200 |
---|---|---|
committer | Simona Vetter <simona.vetter@ffwll.ch> | 2024-09-11 09:18:15 +0200 |
commit | b615b9c36cae0468491547206406a909a9a37f26 (patch) | |
tree | 1d9586e498714e56e7923765640ae014584e1f58 /rust/kernel/alloc/box_ext.rs | |
parent | Merge tag 'drm-misc-next-fixes-2024-09-05' of https://gitlab.freedesktop.org/... (diff) | |
parent | Linux 6.11-rc7 (diff) | |
download | linux-b615b9c36cae0468491547206406a909a9a37f26.tar.xz linux-b615b9c36cae0468491547206406a909a9a37f26.zip |
Merge v6.11-rc7 into drm-next
Thomas needs 5a498d4d06d6 ("drm/fbdev-dma: Only install deferred I/O
if necessary") in drm-misc, so start the backmerge cascade.
Signed-off-by: Simona Vetter <simona.vetter@ffwll.ch>
Diffstat (limited to 'rust/kernel/alloc/box_ext.rs')
-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))] |