mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-07 04:09:21 +00:00
[PATCH] kallsyms: handle malloc() failure
This fixes coverity bugs #398 and #397 Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
2ab1346085
commit
f1a136e0d0
1 changed files with 11 additions and 1 deletions
|
@ -124,6 +124,11 @@ static int read_symbol(FILE *in, struct sym_entry *s)
|
|||
* compressed together */
|
||||
s->len = strlen(str) + 1;
|
||||
s->sym = malloc(s->len + 1);
|
||||
if (!s->sym) {
|
||||
fprintf(stderr, "kallsyms failure: "
|
||||
"unable to allocate required amount of memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
strcpy((char *)s->sym + 1, str);
|
||||
s->sym[0] = stype;
|
||||
|
||||
|
@ -272,7 +277,12 @@ static void write_src(void)
|
|||
|
||||
/* table of offset markers, that give the offset in the compressed stream
|
||||
* every 256 symbols */
|
||||
markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
|
||||
markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
|
||||
if (!markers) {
|
||||
fprintf(stderr, "kallsyms failure: "
|
||||
"unable to allocate required memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
output_label("kallsyms_names");
|
||||
off = 0;
|
||||
|
|
Loading…
Reference in a new issue