diff options
author | Randy Dunlap <rdunlap@infradead.org> | 2018-08-15 12:30:38 -0700 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-08-22 23:21:40 +0900 |
commit | 1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014 (patch) | |
tree | 0c2549d32c719097ea6e9e37c05c272bbf0690f3 /scripts/mod | |
parent | f498926c47aa7d4f1b6d08af2ba16f3cf8fcb151 (diff) | |
download | linux-stable-1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014.tar.gz linux-stable-1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014.tar.bz2 linux-stable-1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014.zip |
scripts: modpost: check memory allocation results
Fix missing error check for memory allocation functions in
scripts/mod/modpost.c.
Fixes kernel bugzilla #200319:
https://bugzilla.kernel.org/show_bug.cgi?id=200319
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yuexing Wang <wangyxlandq@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/mod')
-rw-r--r-- | scripts/mod/modpost.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index dc6d714e4dcb..0d998c54564d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -672,7 +672,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) break; if (symname[0] == '.') { - char *munged = strdup(symname); + char *munged = NOFAIL(strdup(symname)); munged[0] = '_'; munged[1] = toupper(munged[1]); symname = munged; @@ -1318,7 +1318,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, static char *sec2annotation(const char *s) { if (match(s, init_exit_sections)) { - char *p = malloc(20); + char *p = NOFAIL(malloc(20)); char *r = p; *p++ = '_'; @@ -1338,7 +1338,7 @@ static char *sec2annotation(const char *s) strcat(p, " "); return r; } else { - return strdup(""); + return NOFAIL(strdup("")); } } @@ -2036,7 +2036,7 @@ void buf_write(struct buffer *buf, const char *s, int len) { if (buf->size - buf->pos < len) { buf->size += len + SZ; - buf->p = realloc(buf->p, buf->size); + buf->p = NOFAIL(realloc(buf->p, buf->size)); } strncpy(buf->p + buf->pos, s, len); buf->pos += len; |