diff options
-rw-r--r-- | scripts/mod/modpost.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 12d3db3bd46b..d583c98fde31 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -2133,6 +2133,11 @@ static void add_staging_flag(struct buffer *b, const char *name) | |||
2133 | buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); | 2133 | buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); |
2134 | } | 2134 | } |
2135 | 2135 | ||
2136 | /* In kernel, this size is defined in linux/module.h; | ||
2137 | * here we use Elf_Addr instead of long for covering cross-compile | ||
2138 | */ | ||
2139 | #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr)) | ||
2140 | |||
2136 | /** | 2141 | /** |
2137 | * Record CRCs for unresolved symbols | 2142 | * Record CRCs for unresolved symbols |
2138 | **/ | 2143 | **/ |
@@ -2177,6 +2182,12 @@ static int add_versions(struct buffer *b, struct module *mod) | |||
2177 | s->name, mod->name); | 2182 | s->name, mod->name); |
2178 | continue; | 2183 | continue; |
2179 | } | 2184 | } |
2185 | if (strlen(s->name) >= MODULE_NAME_LEN) { | ||
2186 | merror("too long symbol \"%s\" [%s.ko]\n", | ||
2187 | s->name, mod->name); | ||
2188 | err = 1; | ||
2189 | break; | ||
2190 | } | ||
2180 | buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n", | 2191 | buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n", |
2181 | s->crc, s->name); | 2192 | s->crc, s->name); |
2182 | } | 2193 | } |