aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-07-01 04:10:19 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-07-01 04:10:19 -0400
commit534b89a9f6a86a28300cd71619112c4bbca7c0ae (patch)
treebdde1be43f714e671f83f860f528f1065f597d98 /scripts
parent66392c4f2246641c13b5dc60d15b09a71e09276f (diff)
kbuild: fix segv in modpost
Parsing an old Modules.symvers file casued modpost to SEGV. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0dd16177642d..65411665e13c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -205,6 +205,8 @@ static const char *export_str(enum export ex)
205static enum export export_no(const char * s) 205static enum export export_no(const char * s)
206{ 206{
207 int i; 207 int i;
208 if (!s)
209 return export_unknown;
208 for (i = 0; export_list[i].export != export_unknown; i++) { 210 for (i = 0; export_list[i].export != export_unknown; i++) {
209 if (strcmp(export_list[i].str, s) == 0) 211 if (strcmp(export_list[i].str, s) == 0)
210 return export_list[i].export; 212 return export_list[i].export;
@@ -1271,7 +1273,7 @@ static void write_if_changed(struct buffer *b, const char *fname)
1271} 1273}
1272 1274
1273/* parse Module.symvers file. line format: 1275/* parse Module.symvers file. line format:
1274 * 0x12345678<tab>symbol<tab>module[<tab>export] 1276 * 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something]
1275 **/ 1277 **/
1276static void read_dump(const char *fname, unsigned int kernel) 1278static void read_dump(const char *fname, unsigned int kernel)
1277{ 1279{
@@ -1284,7 +1286,7 @@ static void read_dump(const char *fname, unsigned int kernel)
1284 return; 1286 return;
1285 1287
1286 while ((line = get_next_line(&pos, file, size))) { 1288 while ((line = get_next_line(&pos, file, size))) {
1287 char *symname, *modname, *d, *export; 1289 char *symname, *modname, *d, *export, *end;
1288 unsigned int crc; 1290 unsigned int crc;
1289 struct module *mod; 1291 struct module *mod;
1290 struct symbol *s; 1292 struct symbol *s;
@@ -1297,7 +1299,8 @@ static void read_dump(const char *fname, unsigned int kernel)
1297 *modname++ = '\0'; 1299 *modname++ = '\0';
1298 if ((export = strchr(modname, '\t')) != NULL) 1300 if ((export = strchr(modname, '\t')) != NULL)
1299 *export++ = '\0'; 1301 *export++ = '\0';
1300 1302 if (export && ((end = strchr(export, '\t')) != NULL))
1303 *end = '\0';
1301 crc = strtoul(line, &d, 16); 1304 crc = strtoul(line, &d, 16);
1302 if (*symname == '\0' || *modname == '\0' || *d != '\0') 1305 if (*symname == '\0' || *modname == '\0' || *d != '\0')
1303 goto fail; 1306 goto fail;