Control: tag -1 upstream patch The problem seems to be that depmod_report_cycles() sees not just the modules in the cycle but all their non-cyclic dependencies too. When it follows the chain from a module that isn't part of the cycle, it proceeds to print its dependency chain as if it were a cycle but miscalculates the buffer size needed for that. (I do wonder why it bothers to use its own buffer for this rather than relying on stdio buffering.)
This changes the function to: - say nothing about modules that aren't part of a cycle - not claim to know the number of modules in cycles (since some of them aren't) It seems like there should be a more elegant fix, but I don't understand the control flow of this function well enough to improve on this. diff --git a/tools/depmod.c b/tools/depmod.c index a2e07c15ba60..fb0f23c66da7 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -1455,7 +1455,7 @@ static void depmod_report_cycles(struct depmod *depmod, uint16_t n_mods, { const char sep[] = " -> "; int ir = 0; - ERR("Found %u modules in dependency cycles!\n", n_roots); + ERR("Found a dependency cycle!\n"); while (n_roots > 0) { int is, ie; @@ -1500,6 +1500,8 @@ static void depmod_report_cycles(struct depmod *depmod, uint16_t n_mods, break; } } + if (i < 0) + continue; buf = malloc(sz + n * strlen(sep) + 1); sz = 0; -- Ben Hutchings Every program is either trivial or else contains at least one bug
signature.asc
Description: Digital signature