summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLaine Taffin Altman <alexanderaltman@me.com>2024-04-03 14:06:59 -0700
committerMiguel Ojeda <ojeda@kernel.org>2024-04-04 12:56:16 +0200
commit49ceae68a0df9a92617a61e9ce8a0efcf6419585 (patch)
tree6fc29f6283b355f0aa00991c8fb61eb49dba682d /sound
parent01848eee20c6396e5a96cfbc9061dc37481e06fd (diff)
downloadlinux-stable-49ceae68a0df9a92617a61e9ce8a0efcf6419585.tar.gz
linux-stable-49ceae68a0df9a92617a61e9ce8a0efcf6419585.tar.bz2
linux-stable-49ceae68a0df9a92617a61e9ce8a0efcf6419585.zip
rust: init: remove impl Zeroable for Infallible
In Rust, producing an invalid value of any type is immediate undefined behavior (UB); this includes via zeroing memory. Therefore, since an uninhabited type has no valid values, producing any values at all for it is UB. The Rust standard library type `core::convert::Infallible` is uninhabited, by virtue of having been declared as an enum with no cases, which always produces uninhabited types in Rust. The current kernel code allows this UB to be triggered, for example by code like `Box::<core::convert::Infallible>::init(kernel::init::zeroed())`. Thus, remove the implementation of `Zeroable` for `Infallible`, thereby avoiding the unsoundness (potential for future UB). Cc: stable@vger.kernel.org Fixes: 38cde0bd7b67 ("rust: init: add `Zeroable` trait and `init::zeroed` function") Closes: https://github.com/Rust-for-Linux/pinned-init/pull/13 Signed-off-by: Laine Taffin Altman <alexanderaltman@me.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/CA160A4E-561E-4918-837E-3DCEBA74F808@me.com [ Reformatted the comment slightly. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'sound')
0 files changed, 0 insertions, 0 deletions