summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@infradead.org>2018-08-15 12:30:38 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-15 09:45:27 +0200
commitab4bddc2d032b175c4c9689a6a6f3e50d1c66f5a (patch)
tree5b0d9e38797943f9fe427637c5610b50dfbc9dde /scripts
parent7bbf1e8a2471d3f604bf91578ebed067461ba4e7 (diff)
downloadlinux-exynos-ab4bddc2d032b175c4c9689a6a6f3e50d1c66f5a.tar.gz
linux-exynos-ab4bddc2d032b175c4c9689a6a6f3e50d1c66f5a.tar.bz2
linux-exynos-ab4bddc2d032b175c4c9689a6a6f3e50d1c66f5a.zip
scripts: modpost: check memory allocation results
[ Upstream commit 1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014 ] 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> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 54deaa1066cf..957f6041dd79 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -677,7 +677,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;
@@ -1329,7 +1329,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++ = '_';
@@ -1349,7 +1349,7 @@ static char *sec2annotation(const char *s)
strcat(p, " ");
return r;
} else {
- return strdup("");
+ return NOFAIL(strdup(""));
}
}
@@ -2050,7 +2050,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;