mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: util/cbfstool: Initialize elf_writer pointer to avoid crash
If some error happens in cbfs_payload_make_elf, the code jumps to "out", and elf_writer_destroy(ew) is called. This may happen before an elf writer is allocated. To avoid accessing an uninitialized pointer, initialize ew to NULL; elf_writer_destroy will perform no action in this case. BUG=None BRANCH=None TEST=None Signed-off-by: Jonathan Neuschfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/16124 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Change-Id: I5f1f9c4d37f2bdeaaeeca7a15720c7b4c963d953 Reviewed-on: https://chromium-review.googlesource.com/369111 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
parent
47132068e4
commit
2ba4d71d28
1 changed files with 1 additions and 1 deletions
|
@ -1052,7 +1052,7 @@ static int cbfs_payload_make_elf(struct buffer *buff, uint32_t arch)
|
|||
Elf64_Ehdr ehdr;
|
||||
Elf64_Shdr shdr;
|
||||
struct cbfs_payload_segment *segs = NULL;
|
||||
struct elf_writer *ew;
|
||||
struct elf_writer *ew = NULL;
|
||||
struct buffer elf_out;
|
||||
int segments = 0;
|
||||
int retval = -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue