From da99651a87a5e9013f7c107553c85e7f0bceeb1d Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 28 Feb 2024 15:23:08 +0100 Subject: [PATCH] lib_manager: Add const to library manifest variable Added a const modifier to the module manifest variable in the lib_manager_store_library function to prevent it from being accidentally modified. Signed-off-by: Adrian Warecki --- src/library_manager/lib_manager.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/library_manager/lib_manager.c b/src/library_manager/lib_manager.c index 18f3fc913933..96b8289b3249 100644 --- a/src/library_manager/lib_manager.c +++ b/src/library_manager/lib_manager.c @@ -719,11 +719,11 @@ static void __sparse_cache *lib_manager_allocate_store_mem(uint32_t size, } static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext, - void __sparse_cache *man_buffer, + const void __sparse_cache *man_buffer, uint32_t lib_id) { void __sparse_cache *library_base_address; - struct sof_man_fw_desc *man_desc = (struct sof_man_fw_desc *) + const struct sof_man_fw_desc *man_desc = (struct sof_man_fw_desc *) ((__sparse_force uint8_t *)man_buffer + SOF_MAN_ELF_TEXT_OFFSET); uint32_t preload_size = man_desc->header.preload_page_count * PAGE_SZ; int ret; @@ -741,7 +741,7 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext, #if CONFIG_LIBRARY_AUTH_SUPPORT /* AUTH_PHASE_FIRST - checks library manifest only. */ - ret = lib_manager_auth_proc((__sparse_force void *)man_buffer, + ret = lib_manager_auth_proc((__sparse_force const void *)man_buffer, MAN_MAX_SIZE_V1_8, AUTH_PHASE_FIRST); if (ret < 0) { rfree((__sparse_force void *)library_base_address); @@ -751,7 +751,7 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext, /* Copy data from temp_mft_buf to destination memory (pointed by library_base_address) */ memcpy_s((__sparse_force void *)library_base_address, MAN_MAX_SIZE_V1_8, - (__sparse_force void *)man_buffer, MAN_MAX_SIZE_V1_8); + (__sparse_force const void *)man_buffer, MAN_MAX_SIZE_V1_8); /* Copy remaining library part into storage buffer */ ret = lib_manager_store_data(dma_ext, (uint8_t __sparse_cache *)library_base_address +