From ad5ac6e67288e3606704f608cf2c98939392f5b4 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Wed, 9 Oct 2024 16:26:25 +0100 Subject: [PATCH] tools/depmod: avoid casting symbol_free() function type With clang 17, -fsanitize=function is enabled alongside any other sanitizers. Which flags undefined behaviour, since the function type (argument type really) is not compatible. Reference: https://reviews.llvm.org/D148827#4422631 Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/180 Signed-off-by: Lucas De Marchi --- tools/depmod.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/depmod.c b/tools/depmod.c index d71c31b7..a28666c7 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -960,8 +960,10 @@ static int mod_add_dependency(struct mod *mod, struct symbol *sym) return 0; } -static void symbol_free(struct symbol *sym) +static void symbol_free(void *data) { + struct symbol *sym = data; + DBG("free %p sym=%s, owner=%p %s\n", sym, sym->name, sym->owner, sym->owner != NULL ? sym->owner->path : ""); free(sym); @@ -988,7 +990,7 @@ static int depmod_init(struct depmod *depmod, struct cfg *cfg, struct kmod_ctx * goto modules_by_name_failed; } - depmod->symbols = hash_new(2048, (void (*)(void *))symbol_free); + depmod->symbols = hash_new(2048, symbol_free); if (depmod->symbols == NULL) { err = -errno; goto symbols_failed; -- 2.47.3