aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c18
-rw-r--r--scripts/mod/modpost.c5
2 files changed, 20 insertions, 3 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d4dc222a74f3..4eea60b1693e 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size,
210static int do_hid_entry(const char *filename, 210static int do_hid_entry(const char *filename,
211 struct hid_device_id *id, char *alias) 211 struct hid_device_id *id, char *alias)
212{ 212{
213 id->bus = TO_NATIVE(id->bus);
213 id->vendor = TO_NATIVE(id->vendor); 214 id->vendor = TO_NATIVE(id->vendor);
214 id->product = TO_NATIVE(id->product); 215 id->product = TO_NATIVE(id->product);
215 216
@@ -366,11 +367,17 @@ static void do_pnp_device_entry(void *symval, unsigned long size,
366 367
367 for (i = 0; i < count; i++) { 368 for (i = 0; i < count; i++) {
368 const char *id = (char *)devs[i].id; 369 const char *id = (char *)devs[i].id;
370 char acpi_id[sizeof(devs[0].id)];
371 int j;
369 372
370 buf_printf(&mod->dev_table_buf, 373 buf_printf(&mod->dev_table_buf,
371 "MODULE_ALIAS(\"pnp:d%s*\");\n", id); 374 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
375
376 /* fix broken pnp bus lowercasing */
377 for (j = 0; j < sizeof(acpi_id); j++)
378 acpi_id[j] = toupper(id[j]);
372 buf_printf(&mod->dev_table_buf, 379 buf_printf(&mod->dev_table_buf,
373 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); 380 "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id);
374 } 381 }
375} 382}
376 383
@@ -416,10 +423,17 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
416 423
417 /* add an individual alias for every device entry */ 424 /* add an individual alias for every device entry */
418 if (!dup) { 425 if (!dup) {
426 char acpi_id[sizeof(card->devs[0].id)];
427 int k;
428
419 buf_printf(&mod->dev_table_buf, 429 buf_printf(&mod->dev_table_buf,
420 "MODULE_ALIAS(\"pnp:d%s*\");\n", id); 430 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
431
432 /* fix broken pnp bus lowercasing */
433 for (k = 0; k < sizeof(acpi_id); k++)
434 acpi_id[k] = toupper(id[k]);
421 buf_printf(&mod->dev_table_buf, 435 buf_printf(&mod->dev_table_buf,
422 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); 436 "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id);
423 } 437 }
424 } 438 }
425 } 439 }
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 88921611b22e..7e62303133dc 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -415,8 +415,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
415 const char *secstrings 415 const char *secstrings
416 = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 416 = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
417 const char *secname; 417 const char *secname;
418 int nobits = sechdrs[i].sh_type == SHT_NOBITS;
418 419
419 if (sechdrs[i].sh_offset > info->size) { 420 if (!nobits && sechdrs[i].sh_offset > info->size) {
420 fatal("%s is truncated. sechdrs[i].sh_offset=%lu > " 421 fatal("%s is truncated. sechdrs[i].sh_offset=%lu > "
421 "sizeof(*hrd)=%zu\n", filename, 422 "sizeof(*hrd)=%zu\n", filename,
422 (unsigned long)sechdrs[i].sh_offset, 423 (unsigned long)sechdrs[i].sh_offset,
@@ -425,6 +426,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
425 } 426 }
426 secname = secstrings + sechdrs[i].sh_name; 427 secname = secstrings + sechdrs[i].sh_name;
427 if (strcmp(secname, ".modinfo") == 0) { 428 if (strcmp(secname, ".modinfo") == 0) {
429 if (nobits)
430 fatal("%s has NOBITS .modinfo\n", filename);
428 info->modinfo = (void *)hdr + sechdrs[i].sh_offset; 431 info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
429 info->modinfo_len = sechdrs[i].sh_size; 432 info->modinfo_len = sechdrs[i].sh_size;
430 } else if (strcmp(secname, "__ksymtab") == 0) 433 } else if (strcmp(secname, "__ksymtab") == 0)