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
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, · 1 unmodified line
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");

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