]> 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:23:10 +0000 (15:23 -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>
(cherry picked from commit a0fc05940cefa7f79a48132ff6029658b4aeab49)

libkmod/libkmod-module.c

index 0d74100cb74cde86dd844228dd8cebc5522634d5..688a9c0143bb03a0cd679e1f8a9bd4a39e4f59ce 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);