]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
tools/depmod: avoid casting symbol_free() function type
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 9 Oct 2024 15:26:25 +0000 (16:26 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 15 Oct 2024 18:37:11 +0000 (13:37 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/180
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
tools/depmod.c

index d71c31b737340aad56dd11a4980e9efb80779d6c..a28666c7d9223fd4f0ce2d3369f1b73cf047fd62 100644 (file)
@@ -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;