From d9ebdb0c9f55678e33a54802d459af0dc453232e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 12 May 2025 15:14:24 +0200 Subject: [PATCH 1/2] ipc4: fix an "unused variable" warning, found by a fuzzer If logging is disabled, the sof_uuid variable in ipc4_get_drv() will be unused. Add an attribute to fix a compilation failure. Signed-off-by: Guennadi Liakhovetski --- src/ipc/ipc4/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipc/ipc4/helper.c b/src/ipc/ipc4/helper.c index f727d212f179..1bbe23acabb7 100644 --- a/src/ipc/ipc4/helper.c +++ b/src/ipc/ipc4/helper.c @@ -942,7 +942,7 @@ int ipc4_process_on_core(uint32_t core, bool blocking) __cold static const struct comp_driver *ipc4_get_drv(const void *uuid) { - const struct sof_uuid *const sof_uuid = (const struct sof_uuid *)uuid; + const struct sof_uuid *const sof_uuid __maybe_unused = (const struct sof_uuid *)uuid; struct comp_driver_list *drivers = comp_drivers_get(); struct list_item *clist; const struct comp_driver *drv = NULL; From 746f7576e0b9497898504050a8e5d86c2d852fb4 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 13 May 2025 10:08:34 +0200 Subject: [PATCH 2/2] ipc: fix two unused variables in fuzz_isr() comp_new and comp_idx in fuzz_isr() are only used with IPC3, move their definitions under the #ifdef. Signed-off-by: Guennadi Liakhovetski --- src/platform/posix/ipc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform/posix/ipc.c b/src/platform/posix/ipc.c index b8c54b9a38d9..f9fc0213987f 100644 --- a/src/platform/posix/ipc.c +++ b/src/platform/posix/ipc.c @@ -45,8 +45,6 @@ static size_t fuzz_in_sz; static void fuzz_isr(const void *arg) { size_t rem, i, n = MIN(posix_fuzz_sz, sizeof(fuzz_in) - fuzz_in_sz); - bool comp_new = false; - int comp_idx = 0; for (i = 0; i < n; i++) fuzz_in[fuzz_in_sz++] = posix_fuzz_buf[i]; @@ -68,6 +66,9 @@ static void fuzz_isr(const void *arg) fuzz_in_sz = rem; #ifdef CONFIG_IPC_MAJOR_3 + bool comp_new = false; + int comp_idx = 0; + // One special case: a first byte of 0xff (which is in the // otherwise-ignored size value at the front of the command -- // we rewrite those) is interpreted as a "component new"