ppc/pnv: check for firmware file presence
PATCH 1/1 ppc/pnv: check for firmware file presence
and exit before uslessly trying to load it if the file does not exists.
Issue dicovered by Coverity Scan.
--- hw/ppc/pnv.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/ppc/pnv.c +4 -0
@@ -570,6 +570,10 @@ static void ppc_powernv_init(MachineState *machine) } fw_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!fw_filename) { +error_report ("Could not find OPAL '%s'" , bios_name); +exit (1 ); + } fw_size =load_image_targphys (fw_filename,FW_LOAD_ADDR ,FW_MAX_SIZE );if (fw_size <0 ) {
Signature · 1 line
2.13.5
Quoted 1 line · Cédric Le Goater
and exit before uslessly trying to load it if the file does
s/uslessly/uselessly/
Quoted 3 lines
not exists.
Issue dicovered by Coverity Scan.
/dicovered/discovered/
Quoted 10 lines
Signed-off-by Cédric Le Goater <[email protected]>--- hw/ppc/pnv.c | 4 ++++ 1 file changed, 4 insertions(+)hw/ppc/pnv.c +0
-0
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 574
Quoted 5 lines
hw/ppc/pnv.c +2
-0@@ -570,6 +570,10 @@ static void ppc_powernv_init(MachineState *machine) } fw_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!fw_filename) { +error_report ("Could not find OPAL '%s'" , bios_name);
I'd suggest to say "OPAL firmware" instead of just "OPAL". Not every user knows what OPAL is.
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 579
Quoted 6 lines
hw/ppc/pnv.c +2
-0+exit (1 ); + } fw_size =load_image_targphys (fw_filename,FW_LOAD_ADDR ,FW_MAX_SIZE );if (fw_size <0 ) {
Thomas
Quoted 10 lines · Thomas Huth
Quoted 1 line · Cédric Le Goater
and exit before uslessly trying to load it if the file does
s/uslessly/uselessly/
Quoted 3 lines
not exists.
Issue dicovered by Coverity Scan.
/dicovered/discovered/
arg. Sorry about that.
Quoted 12 lines
Quoted 12 lines
Signed-off-by Cédric Le Goater <[email protected]>--- hw/ppc/pnv.c | 4 ++++ 1 file changed, 4 insertions(+)hw/ppc/pnv.c +0
-0@@ -570,6 +570,10 @@ static void ppc_powernv_init(MachineState *machine) }
Quoted 6 lines
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 574
Quoted 3 lines
hw/ppc/pnv.c +2
-0fw_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!fw_filename) { +error_report ("Could not find OPAL '%s'" , bios_name);I'd suggest to say "OPAL firmware" instead of just "OPAL". Not every user knows what OPAL is.
Yes it deserves a resend anyhow.
thanks,
C.
Quoted 9 lines
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 579
Quoted 6 lines
hw/ppc/pnv.c +2
-0+exit (1 ); + } fw_size =load_image_targphys (fw_filename,FW_LOAD_ADDR ,FW_MAX_SIZE );if (fw_size <0 ) {Thomas
Greg Kurz
Reviewed-byQuoted 11 lines · On Mon, 25 Sep 2017 10:46:13 +0200 Thomas Huth <[email protected]> wrote:
Quoted 1 line · Cédric Le Goater
and exit before uslessly trying to load it if the file does
s/uslessly/uselessly/
Quoted 3 lines
not exists.
Issue dicovered by Coverity Scan.
/dicovered/discovered/
Mentioning the Coverity Id (ie, CID 1381410) is also a usual practice.
Quoted 12 lines
Quoted 12 lines
Signed-off-by Cédric Le Goater <[email protected]>--- hw/ppc/pnv.c | 4 ++++ 1 file changed, 4 insertions(+)hw/ppc/pnv.c +0
-0@@ -570,6 +570,10 @@ static void ppc_powernv_init(MachineState *machine) }
Quoted 7 lines
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 574
Quoted 3 lines
hw/ppc/pnv.c +2
-0fw_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!fw_filename) { +error_report ("Could not find OPAL '%s'" , bios_name);I'd suggest to say "OPAL firmware" instead of just "OPAL". Not every user knows what OPAL is.
With all the suggested changes:
Quoted 8 lines
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 579
Quoted 6 lines
hw/ppc/pnv.c +2
-0+exit (1 ); + } fw_size =load_image_targphys (fw_filename,FW_LOAD_ADDR ,FW_MAX_SIZE );if (fw_size <0 ) {Thomas
Signature · 7 lines
Gregory Kurz [email protected] [email protected] Software Engineer @ IBM/LTC http://www.ibm.com Tel 33-5-6218-1607 "Anarchy is about taking complete responsibility for yourself." Alan Moore.
Quoted 8 lines · Greg Kurz
Quoted 5 lines · On Mon, 25 Sep 2017 10:46:13 +0200 Thomas Huth <[email protected]> wrote:
Quoted 1 line · Cédric Le Goater
and exit before uslessly trying to load it if the file does
s/uslessly/uselessly/
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
not exists.
Issue dicovered by Coverity Scan.
/dicovered/discovered/
Mentioning the Coverity Id (ie, CID 1381410) is also a usual practice.
ah. too late :/
C.
Quoted 35 lines
Quoted 12 lines
Quoted 12 lines
Signed-off-by Cédric Le Goater <[email protected]>--- hw/ppc/pnv.c | 4 ++++ 1 file changed, 4 insertions(+)hw/ppc/pnv.c +0
-0@@ -570,6 +570,10 @@ static void ppc_powernv_init(MachineState *machine) }Quoted 7 lines
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 574
Quoted 3 lines
hw/ppc/pnv.c +2
-0fw_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!fw_filename) { +error_report ("Could not find OPAL '%s'" , bios_name);I'd suggest to say "OPAL firmware" instead of just "OPAL". Not every user knows what OPAL is.
With all the suggested changes:
Reviewed-by Greg Kurz <[email protected]>Quoted 8 lines
hw/ppc/pnv.c static void ppc_powernv_init(MachineState *machine) · line 579
Quoted 6 lines
hw/ppc/pnv.c +2
-0+exit (1 ); + } fw_size =load_image_targphys (fw_filename,FW_LOAD_ADDR ,FW_MAX_SIZE );if (fw_size <0 ) {Thomas