If modpost was called manually with filenames without '/' then modpost would segfault.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -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"); |