diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-05-17 14:31:51 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-05-18 15:25:59 +1000 |
commit | dd420a7f0647c96f249fe9e049b51890354f3c7a (patch) | |
tree | 54e4e4297524ce04dc8edb9e6ed59a614f848feb /core | |
parent | 94c7f9a21d35c4237a8e5ee82199e69935b02e28 (diff) | |
download | skiboot-dd420a7f0647c96f249fe9e049b51890354f3c7a.zip skiboot-dd420a7f0647c96f249fe9e049b51890354f3c7a.tar.gz skiboot-dd420a7f0647c96f249fe9e049b51890354f3c7a.tar.bz2 |
hdata: Make hdata_to_dt more suitable for fuzzing
We make parse_hdat() return success/failure rather than assert.
This allows the hdata_to_dt binary to gracefully error out rather
than assert, which is useful when throwing it at a fuzzer.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/init.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/init.c b/core/init.c index a72972d..4542a1d 100644 --- a/core/init.c +++ b/core/init.c @@ -634,11 +634,13 @@ void __noreturn main_cpu_entry(const void *fdt, u32 master_cpu) * Hack alert: When entering via the OPAL entry point, fdt * is set to -1, we record that and pass it to parse_hdat */ - if (fdt == (void *)-1ul) - parse_hdat(true, master_cpu); - else if (fdt == NULL) - parse_hdat(false, master_cpu); - else { + if (fdt == (void *)-1ul) { + if (parse_hdat(true, master_cpu) < 0) + abort(); + } else if (fdt == NULL) { + if (parse_hdat(false, master_cpu) < 0) + abort(); + } else { dt_expand(fdt); } |