Added negative check for get_image_size()
PATCH 1/1 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 <[email protected]>
--- hw/ppc/spapr.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/ppc/spapr.c +4 -0
@@ -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);
Signature · 1 line
2.5.5
David Gibson
AppliedQuoted 4 lines · Zhou Jie
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 <[email protected]>
Applied to ppc-for-2.7, thanks.
Quoted 19 lines
--- hw/ppc/spapr.c | 4 ++++ 1 file changed, 4 insertions(+)hw/ppc/spapr.c +4
-0@@ -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);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson