History

kbuild: fix segmentation fault in modpost

If modpost was called manually with filenames without '/' then modpost would segfault.

Sam Ravnborg committed 19 years ago

Commit a61b2df1 parent 9bf8cb91 file · +6 −2Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/mod/modpost.c+6−2
@@ -1345,6 +1345,7 @@ static void add_depends(struct buffer *b, struct module *mod, · 1344 unmodified lines
13451345 buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
13461346 buf_printf(b, "\"depends=");
13471347 for (s = mod->unres; s; s = s->next) {
1348+ const char *p;
13481349 if (!s->module)
13491350 continue;
13501351
@@ -1352,8 +1353,11 @@ static void add_depends(struct buffer *b, struct module *mod, · 1 unmodified line
13521353 continue;
13531354
13541355 s->module->seen = 1;
1355− buf_printf(b, "%s%s", first ? "" : ",",
1356− strrchr(s->module->name, '/') + 1);
1356+ if ((p = strrchr(s->module->name, '/')) != NULL)
1357+ p++;
1358+ else
1359+ p = s->module->name;
1360+ buf_printf(b, "%s%s", first ? "" : ",", p);
13571361 first = 0;
13581362 }
13591363 buf_printf(b, "\";\n");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t