qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence
@ 2017-09-25  8:58 Cédric Le Goater
  2017-09-25  9:01 ` Thomas Huth
  2017-09-25 23:05 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2017-09-25  8:58 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel, David Gibson, Greg Kurz, Thomas Huth
  Cc: Cédric Le Goater

and exit before uselessly trying to load it if the file does not
exists.

Issue discovered by Coverity Scan.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Changes since v1:

 - fixed spelling
 - improved OPAL naming by adding firmware 

 hw/ppc/pnv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 47221158d415..d46d91c76f5c 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -570,10 +570,14 @@ 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 firmware '%s'", bios_name);
+        exit(1);
+    }
 
     fw_size = load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE);
     if (fw_size < 0) {
-        error_report("Could not load OPAL '%s'", fw_filename);
+        error_report("Could not load OPAL firmware '%s'", fw_filename);
         exit(1);
     }
     g_free(fw_filename);
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence
  2017-09-25  8:58 [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence Cédric Le Goater
@ 2017-09-25  9:01 ` Thomas Huth
  2017-09-25 23:05 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2017-09-25  9:01 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel, David Gibson,
	Greg Kurz

On 25.09.2017 10:58, Cédric Le Goater wrote:
> and exit before uselessly trying to load it if the file does not
> exists.
> 
> Issue discovered by Coverity Scan.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>  Changes since v1:
> 
>  - fixed spelling
>  - improved OPAL naming by adding firmware 
> 
>  hw/ppc/pnv.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 47221158d415..d46d91c76f5c 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -570,10 +570,14 @@ 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 firmware '%s'", bios_name);
> +        exit(1);
> +    }
>  
>      fw_size = load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE);
>      if (fw_size < 0) {
> -        error_report("Could not load OPAL '%s'", fw_filename);
> +        error_report("Could not load OPAL firmware '%s'", fw_filename);
>          exit(1);
>      }
>      g_free(fw_filename);
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence
  2017-09-25  8:58 [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence Cédric Le Goater
  2017-09-25  9:01 ` Thomas Huth
@ 2017-09-25 23:05 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-09-25 23:05 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Thomas Huth

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

On Mon, Sep 25, 2017 at 10:58:25AM +0200, Cédric Le Goater wrote:
> and exit before uselessly trying to load it if the file does not
> exists.
> 
> Issue discovered by Coverity Scan.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied to ppc-for-2.11, thanks.

> ---
> 
>  Changes since v1:
> 
>  - fixed spelling
>  - improved OPAL naming by adding firmware 
> 
>  hw/ppc/pnv.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 47221158d415..d46d91c76f5c 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -570,10 +570,14 @@ 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 firmware '%s'", bios_name);
> +        exit(1);
> +    }
>  
>      fw_size = load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE);
>      if (fw_size < 0) {
> -        error_report("Could not load OPAL '%s'", fw_filename);
> +        error_report("Could not load OPAL firmware '%s'", fw_filename);
>          exit(1);
>      }
>      g_free(fw_filename);

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-25 23:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-25  8:58 [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence Cédric Le Goater
2017-09-25  9:01 ` Thomas Huth
2017-09-25 23:05 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).