summaryrefslogtreecommitdiff
path: root/rust/kernel/error.rs
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2025-07-31 17:48:07 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-28 16:34:43 +0200
commit9cd486e47ca8707183d517c3f86526988499b83d (patch)
tree5b74c4bf1dfa39354f7d2061c3737048baefc493 /rust/kernel/error.rs
parent3340149cebd9185bba088875bd9c56a0cd1e3992 (diff)
rust: drm: ensure kmalloc() compatible Layout
[ Upstream commit 22ab0641b939967f630d108e33a3582841ad6846 ] drm::Device is allocated through __drm_dev_alloc() (which uses kmalloc()) and the driver private data, <T as drm::Driver>::Data, is initialized in-place. Due to the order of fields in drm::Device pub struct Device<T: drm::Driver> { dev: Opaque<bindings::drm_device>, data: T::Data, } even with an arbitrary large alignment requirement of T::Data it can't happen that the size of Device is smaller than its alignment requirement. However, let's not rely on this subtle circumstance and create a proper kmalloc() compatible Layout. Fixes: 1e4b8896c0f3 ("rust: drm: add device abstraction") Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20250731154919.4132-3-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'rust/kernel/error.rs')
0 files changed, 0 insertions, 0 deletions