Skip to content

Commit

Permalink
kbuild: fix segmentation fault in modpost
Browse files Browse the repository at this point in the history
If modpost was called manually with filenames without '/'
then modpost would segfault.

Signed-off-by: Sam Ravnborg <[email protected]>
  • Loading branch information
sravnborg committed May 2, 2007
1 parent 9bf8cb9 commit a61b2df
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1345,15 +1345,19 @@ static void add_depends(struct buffer *b, struct module *mod,
buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
buf_printf(b, "\"depends=");
for (s = mod->unres; s; s = s->next) {
const char *p;
if (!s->module)
continue;

if (s->module->seen)
continue;

s->module->seen = 1;
buf_printf(b, "%s%s", first ? "" : ",",
strrchr(s->module->name, '/') + 1);
if ((p = strrchr(s->module->name, '/')) != NULL)
p++;
else
p = s->module->name;
buf_printf(b, "%s%s", first ? "" : ",", p);
first = 0;
}
buf_printf(b, "\";\n");
Expand Down

0 comments on commit a61b2df

Please sign in to comment.