]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Fix dependency count in kmod_module_parse_depline()
authorYuntao Wang <yuntao.wang@linux.dev>
Fri, 16 May 2025 11:11:02 +0000 (19:11 +0800)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Sat, 17 May 2025 20:21:48 +0000 (15:21 -0500)
The variable n is intended to track the number of dependencies for mod.
However, it is only initialized and not incremented during dependency parsing.

Fix it.

Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Fixes: be728dd34718 ("libkmod: Simplify module dependency parsing")
Link: https://github.com/kmod-project/kmod/pull/348
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-module.c

index fbfbd7b9b76f52c63679ba89d2cbf35b4385c462..2b51010ed2f9c82217f826fcfb00d2452eef0a08 100644 (file)
@@ -172,6 +172,7 @@ void kmod_module_parse_depline(struct kmod_module *mod, char *line)
                        goto fail;
                }
                list = l_new;
+               n++;
        }
 
        DBG(ctx, "%zu dependencies for %s\n", n, mod->name);