diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-05-30 21:09:23 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-31 17:09:12 +0430 |
commit | 2b5732ab7751a9f9111ab24771c0bcfc3550ab2e (patch) | |
tree | 29eb1e83e861bae70d3322e72e4b67e25b6fbf1c /Kernel/VirtIO | |
parent | 3bc2527ce7780e7d9bbe1290e7edf044622b8314 (diff) | |
download | serenity-2b5732ab7751a9f9111ab24771c0bcfc3550ab2e.zip |
AK+Kernel: Disallow implicitly lifting pointers to OwnPtr's
This doesn't really _fix_ anything, it just gets rid of the API and
instead makes the users explicitly use `adopt_own_if_non_null()`.
Diffstat (limited to 'Kernel/VirtIO')
-rw-r--r-- | Kernel/VirtIO/VirtIOQueue.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/VirtIO/VirtIOQueue.cpp b/Kernel/VirtIO/VirtIOQueue.cpp index c890b50e11..8d2611d7c3 100644 --- a/Kernel/VirtIO/VirtIOQueue.cpp +++ b/Kernel/VirtIO/VirtIOQueue.cpp @@ -22,9 +22,9 @@ VirtIOQueue::VirtIOQueue(u16 queue_size, u16 notify_offset) // TODO: ensure alignment!!! u8* ptr = m_queue_region->vaddr().as_ptr(); memset(ptr, 0, m_queue_region->size()); - m_descriptors = reinterpret_cast<VirtIOQueueDescriptor*>(ptr); - m_driver = reinterpret_cast<VirtIOQueueDriver*>(ptr + size_of_descriptors); - m_device = reinterpret_cast<VirtIOQueueDevice*>(ptr + size_of_descriptors + size_of_driver); + m_descriptors = adopt_own_if_nonnull(reinterpret_cast<VirtIOQueueDescriptor*>(ptr)); + m_driver = adopt_own_if_nonnull(reinterpret_cast<VirtIOQueueDriver*>(ptr + size_of_descriptors)); + m_device = adopt_own_if_nonnull(reinterpret_cast<VirtIOQueueDevice*>(ptr + size_of_descriptors + size_of_driver)); for (auto i = 0; i + 1 < queue_size; i++) { m_descriptors[i].next = i + 1; // link all of the descriptors in a line |