From ac31a3defa0fe5889d0d239be69f320986ead8a2 Mon Sep 17 00:00:00 2001 From: Lightos1 <124387232+Lightos1@users.noreply.github.com> Date: Sun, 30 Aug 2026 20:16:38 +0200 Subject: [PATCH] Revert "ipc: allow mismatached provided buffer size as long as the stable region is covered" This reverts commit 40ec8dee8cd912b607925b9ef3ef0525a83e368a. --- Source/hoc-clk/sysmodule/src/ipc/ipc_service.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/hoc-clk/sysmodule/src/ipc/ipc_service.cpp b/Source/hoc-clk/sysmodule/src/ipc/ipc_service.cpp index c51f8195..f1e01d9b 100644 --- a/Source/hoc-clk/sysmodule/src/ipc/ipc_service.cpp +++ b/Source/hoc-clk/sysmodule/src/ipc/ipc_service.cpp @@ -24,7 +24,6 @@ * -------------------------------------------------------------------------- */ -#include #include #include #include @@ -49,8 +48,6 @@ namespace ipcService { LockableMutex gThreadMutex; IpcServer gServer; - constexpr size_t gMinContextBufSize = offsetof(HocClkContext, stable) + sizeof(HocClkContext::stable); - Result GetApiVersion(u32 *out_version) { *out_version = HOCCLK_IPC_API_VERSION; return 0; @@ -63,9 +60,8 @@ namespace ipcService { return 0; } - Result GetCurrentContext(void *out_buf, size_t bufSize) { - HocClkContext ctx = clockManager::GetCurrentContext(); - memcpy(out_buf, &ctx, bufSize < sizeof(ctx) ? bufSize : sizeof(ctx)); + Result GetCurrentContext(HocClkContext *out_ctx) { + *out_ctx = clockManager::GetCurrentContext(); return 0; } @@ -166,8 +162,8 @@ namespace ipcService { case HocClkIpcCmd_GetCurrentContext: if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) { size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers); - if (bufSize >= gMinContextBufSize) { - return GetCurrentContext(hipcGetBufferAddress(r->hipc.data.recv_buffers), bufSize); + if (bufSize >= sizeof(HocClkContext)) { + return GetCurrentContext((HocClkContext *)hipcGetBufferAddress(r->hipc.data.recv_buffers)); } } break;