From: Tobias Stoeckmann Date: Wed, 18 Sep 2024 19:53:23 +0000 (+0200) Subject: testsuite: Fix init_module X-Git-Tag: v34~321 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6eef551997fe1f6227f18ce584b6f39cc7ae31bf;p=thirdparty%2Fkmod.git testsuite: Fix init_module Apply same logic as in delete_module.c, i.e. pass a reference to a pointer instead of the pointer value, otherwise we cannot update the linked list and added entries are lost. Spotted with ASAN while running testsuite. Signed-off-by: Tobias Stoeckmann Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/141 Signed-off-by: Lucas De Marchi --- diff --git a/testsuite/init_module.c b/testsuite/init_module.c index d842ace0..b6ac1c2d 100644 --- a/testsuite/init_module.c +++ b/testsuite/init_module.c @@ -48,7 +48,7 @@ static struct mod *modules; static bool need_init = true; static struct kmod_ctx *ctx; -static void parse_retcodes(struct mod *_modules, const char *s) +static void parse_retcodes(struct mod **_modules, const char *s) { const char *p; @@ -97,8 +97,8 @@ static void parse_retcodes(struct mod *_modules, const char *s) mod->name[modnamelen] = '\0'; mod->ret = ret; mod->errcode = errcode; - mod->next = _modules; - _modules = mod; + mod->next = *_modules; + *_modules = mod; } } @@ -179,7 +179,7 @@ static void init_retcodes(void) ctx = kmod_new(NULL, NULL); - parse_retcodes(modules, s); + parse_retcodes(&modules, s); } static inline bool module_is_inkernel(const char *modname)