From 4769d798f9f9bae405adf8573fd25f157154712b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 5 Dec 2022 14:48:32 -0500 Subject: kernel/kernel: Ensure shutdown threads are always initialized --- src/core/hle/kernel/kernel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index b77723503..288f97df5 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -891,7 +891,7 @@ struct KernelCore::Impl { Common::ThreadWorker service_threads_manager; Common::Barrier service_thread_barrier; - std::array shutdown_threads; + std::array shutdown_threads{}; std::array, Core::Hardware::NUM_CPU_CORES> schedulers{}; bool is_multicore{}; -- cgit v1.2.3 From dddc9bb8f1aeb2bef78c7264a385d87044ddfa2c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 5 Dec 2022 14:51:15 -0500 Subject: kernel/thread: Ensure stack_top and argument are always initialized --- src/core/hle/kernel/k_thread.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index f38c92bff..dc52b4ed3 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -784,8 +784,8 @@ private: std::vector wait_objects_for_debugging; VAddr mutex_wait_address_for_debugging{}; ThreadWaitReasonForDebugging wait_reason_for_debugging{}; - uintptr_t argument; - VAddr stack_top; + uintptr_t argument{}; + VAddr stack_top{}; public: using ConditionVariableThreadTreeType = ConditionVariableThreadTree; -- cgit v1.2.3 From dcca6505994898ae6ca1a5dc8ebd97c4d279968f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 5 Dec 2022 14:52:13 -0500 Subject: kernel/physical_core: Ensure is_interrupted is always initialized --- src/core/hle/kernel/physical_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h index 2fc8d4be2..fb2ba4c6b 100644 --- a/src/core/hle/kernel/physical_core.h +++ b/src/core/hle/kernel/physical_core.h @@ -85,7 +85,7 @@ private: std::mutex guard; std::condition_variable on_interrupt; std::unique_ptr arm_interface; - bool is_interrupted; + bool is_interrupted{}; }; } // namespace Kernel -- cgit v1.2.3 From c3fd211b43db98309da537533a8b57e1d734d665 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 5 Dec 2022 15:00:34 -0500 Subject: kernel/k_memory_block: Ensure members are always initialized --- src/core/hle/kernel/k_memory_block.h | 33 +++++++++++++--------------- src/core/hle/kernel/k_memory_block_manager.h | 9 ++++---- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/core/hle/kernel/k_memory_block.h b/src/core/hle/kernel/k_memory_block.h index 3b6e7baff..87ca65592 100644 --- a/src/core/hle/kernel/k_memory_block.h +++ b/src/core/hle/kernel/k_memory_block.h @@ -280,18 +280,19 @@ struct KMemoryInfo { class KMemoryBlock : public Common::IntrusiveRedBlackTreeBaseNode { private: - u16 m_device_disable_merge_left_count; - u16 m_device_disable_merge_right_count; - VAddr m_address; - size_t m_num_pages; - KMemoryState m_memory_state; - u16 m_ipc_lock_count; - u16 m_device_use_count; - u16 m_ipc_disable_merge_count; - KMemoryPermission m_permission; - KMemoryPermission m_original_permission; - KMemoryAttribute m_attribute; - KMemoryBlockDisableMergeAttribute m_disable_merge_attribute; + u16 m_device_disable_merge_left_count{}; + u16 m_device_disable_merge_right_count{}; + VAddr m_address{}; + size_t m_num_pages{}; + KMemoryState m_memory_state{KMemoryState::None}; + u16 m_ipc_lock_count{}; + u16 m_device_use_count{}; + u16 m_ipc_disable_merge_count{}; + KMemoryPermission m_permission{KMemoryPermission::None}; + KMemoryPermission m_original_permission{KMemoryPermission::None}; + KMemoryAttribute m_attribute{KMemoryAttribute::None}; + KMemoryBlockDisableMergeAttribute m_disable_merge_attribute{ + KMemoryBlockDisableMergeAttribute::None}; public: static constexpr int Compare(const KMemoryBlock& lhs, const KMemoryBlock& rhs) { @@ -367,12 +368,8 @@ public: constexpr KMemoryBlock(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p, KMemoryAttribute attr) - : Common::IntrusiveRedBlackTreeBaseNode(), - m_device_disable_merge_left_count(), m_device_disable_merge_right_count(), - m_address(addr), m_num_pages(np), m_memory_state(ms), m_ipc_lock_count(0), - m_device_use_count(0), m_ipc_disable_merge_count(), m_permission(p), - m_original_permission(KMemoryPermission::None), m_attribute(attr), - m_disable_merge_attribute() {} + : Common::IntrusiveRedBlackTreeBaseNode(), m_address(addr), m_num_pages(np), + m_memory_state(ms), m_permission(p), m_attribute(attr) {} constexpr void Initialize(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p, KMemoryAttribute attr) { diff --git a/src/core/hle/kernel/k_memory_block_manager.h b/src/core/hle/kernel/k_memory_block_manager.h index 9b5873883..d382722a6 100644 --- a/src/core/hle/kernel/k_memory_block_manager.h +++ b/src/core/hle/kernel/k_memory_block_manager.h @@ -3,6 +3,7 @@ #pragma once +#include #include #include "common/common_funcs.h" @@ -17,9 +18,9 @@ public: static constexpr size_t MaxBlocks = 2; private: - KMemoryBlock* m_blocks[MaxBlocks]; - size_t m_index; - KMemoryBlockSlabManager* m_slab_manager; + std::array m_blocks{}; + size_t m_index{MaxBlocks}; + KMemoryBlockSlabManager* m_slab_manager{}; private: Result Initialize(size_t num_blocks) { @@ -41,7 +42,7 @@ private: public: KMemoryBlockManagerUpdateAllocator(Result* out_result, KMemoryBlockSlabManager* sm, size_t num_blocks = MaxBlocks) - : m_blocks(), m_index(MaxBlocks), m_slab_manager(sm) { + : m_slab_manager(sm) { *out_result = this->Initialize(num_blocks); } -- cgit v1.2.3 From efa8711bf3b933ce95b0722a39ff7ff4aaf426a1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 5 Dec 2022 15:16:50 -0500 Subject: kernel/k_shared_memory: Ensure device_memory is always initialized --- src/core/hle/kernel/k_shared_memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/hle/kernel/k_shared_memory.h b/src/core/hle/kernel/k_shared_memory.h index 5620c3660..a96c55a3e 100644 --- a/src/core/hle/kernel/k_shared_memory.h +++ b/src/core/hle/kernel/k_shared_memory.h @@ -74,7 +74,7 @@ public: static void PostDestroy([[maybe_unused]] uintptr_t arg) {} private: - Core::DeviceMemory* device_memory; + Core::DeviceMemory* device_memory{}; KProcess* owner_process{}; KPageGroup page_list; Svc::MemoryPermission owner_permission{}; -- cgit v1.2.3