diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2007-02-26 13:46:52 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2007-05-02 14:58:07 -0400 |
commit | a61b2dfd1823506dbf1f9b046e0b09237ec1b985 (patch) | |
tree | 9d006090a43cc97a6d3edbaadde2c8f7ae5c5035 /scripts/mod | |
parent | 9bf8cb9b7908383752b1842eae78269f7e16d9fb (diff) |
kbuild: fix segmentation fault in modpost
If modpost was called manually with filenames without '/'
then modpost would segfault.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod')
-rw-r--r-- | scripts/mod/modpost.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index e1f2b31cf34b..281abb77e033 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1345,6 +1345,7 @@ static void add_depends(struct buffer *b, struct module *mod, | |||
1345 | buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n"); | 1345 | buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n"); |
1346 | buf_printf(b, "\"depends="); | 1346 | buf_printf(b, "\"depends="); |
1347 | for (s = mod->unres; s; s = s->next) { | 1347 | for (s = mod->unres; s; s = s->next) { |
1348 | const char *p; | ||
1348 | if (!s->module) | 1349 | if (!s->module) |
1349 | continue; | 1350 | continue; |
1350 | 1351 | ||
@@ -1352,8 +1353,11 @@ static void add_depends(struct buffer *b, struct module *mod, | |||
1352 | continue; | 1353 | continue; |
1353 | 1354 | ||
1354 | s->module->seen = 1; | 1355 | s->module->seen = 1; |
1355 | buf_printf(b, "%s%s", first ? "" : ",", | 1356 | if ((p = strrchr(s->module->name, '/')) != NULL) |
1356 | strrchr(s->module->name, '/') + 1); | 1357 | p++; |
1358 | else | ||
1359 | p = s->module->name; | ||
1360 | buf_printf(b, "%s%s", first ? "" : ",", p); | ||
1357 | first = 0; | 1361 | first = 0; |
1358 | } | 1362 | } |
1359 | buf_printf(b, "\";\n"); | 1363 | buf_printf(b, "\";\n"); |