Skip to content

Commit

Permalink
depmod: Support modules.order with duplicate lines
Browse files Browse the repository at this point in the history
If the same line exists multiple times in modules.order, consider only
the first, since this is the earliest position requested.

This also makes sure that index iterator never turns positive or would
ever trigger a signed integer overflow.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Link: #158
Signed-off-by: Lucas De Marchi <[email protected]>
  • Loading branch information
stoeckmann authored and lucasdemarchi committed Oct 1, 2024
1 parent 19c0df1 commit a1186fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ static void depmod_modules_sort(struct depmod *depmod)
}
line[len - 1] = '\0';
mod = hash_find(depmod->modules_by_uncrelpath, line);
if (mod == NULL)
if (mod == NULL || mod->sort_idx < 0)
continue;
mod->sort_idx = i++;
}
Expand Down

0 comments on commit a1186fa

Please sign in to comment.