aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr.c
diff options
context:
space:
mode:
authorZhou Jie <zhoujie2011@cn.fujitsu.com>2016-04-25 11:36:06 -0400
committerDavid Gibson <david@gibson.dropbear.id.au>2016-05-27 09:40:23 +1000
commit8afc22a20fba6aa078e4e7a625d16d78da768323 (patch)
tree8cf698f4f8ec81a66c0299617989aa39637997b2 /hw/ppc/spapr.c
parent5c29dd8c28c3c7718cc37b38c5171b3caf629928 (diff)
Added negative check for get_image_size()
This patch adds check for negative return value from get_image_size(), where it is missing. It avoids unnecessary two function calls. Signed-off-by: Zhou Jie <zhoujie2011@cn.fujitsu.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr.c')
-rw-r--r--hw/ppc/spapr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index add68acfef..3b0845f158 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1842,6 +1842,10 @@ static void ppc_spapr_init(MachineState *machine)
exit(1);
}
spapr->rtas_size = get_image_size(filename);
+ if (spapr->rtas_size < 0) {
+ error_report("Could not get size of LPAR rtas '%s'", filename);
+ exit(1);
+ }
spapr->rtas_blob = g_malloc(spapr->rtas_size);
if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) {
error_report("Could not load LPAR rtas '%s'", filename);