Skip to contentSkip to conversation

ppc/pnv: check for firmware file presence

PATCH Superseded Cédric Le Goater 3 participants 5 messages Sep 25, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index 47221158d415..7728eece2eec 100644
@@ -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
#1 lore raw
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
---
 hw/ppc/pnv.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/pnv.c +0 -0
index 47221158d415..7728eece2eec 100644

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

#2 lore raw
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
---
 hw/ppc/pnv.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/pnv.c +0 -0
index 47221158d415..7728eece2eec 100644
@@ -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 -0
     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.

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

Reviewed-by
#3 lore raw
In reply to Thomas Huth
Quoted 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
---
 hw/ppc/pnv.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/pnv.c +0 -0
index 47221158d415..7728eece2eec 100644
@@ -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 -0
     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.

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.
#4 lore raw
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
---
 hw/ppc/pnv.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/pnv.c +0 -0
index 47221158d415..7728eece2eec 100644
@@ -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 -0
     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.

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