All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] PPC: e500: Add check for NULL return value from qemu_find_file.
@ 2018-03-03 13:02 Nia Alarie
  2018-03-04 23:51 ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Nia Alarie @ 2018-03-03 13:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: nia.alarie, qemu-ppc, agraf, david, stefanha, jim, joel

This prints a message and exits if the e500 BIOS firmware can't
be found, to avoid dereferencing a null pointer.

Signed-off-by: Nia Alarie <nia.alarie@gmail.com>
---
 hw/ppc/e500.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index a40d3ec3e3..6ce03d6ff4 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -1005,6 +1005,10 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
         }
     }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+    if (!filename) {
+        error_report("Could not find firmware '%s'", bios_name);
+        exit(1);
+    }
 
     bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
                          1, PPC_ELF_MACHINE, 0, 0);
-- 
2.16.2

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

* Re: [Qemu-devel] [PATCH] PPC: e500: Add check for NULL return value from qemu_find_file.
  2018-03-03 13:02 [Qemu-devel] [PATCH] PPC: e500: Add check for NULL return value from qemu_find_file Nia Alarie
@ 2018-03-04 23:51 ` David Gibson
  2018-03-05  1:38   ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2018-03-04 23:51 UTC (permalink / raw)
  To: Nia Alarie; +Cc: qemu-devel, qemu-ppc, agraf, stefanha, jim, joel

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

On Sat, Mar 03, 2018 at 01:02:26PM +0000, Nia Alarie wrote:
> This prints a message and exits if the e500 BIOS firmware can't
> be found, to avoid dereferencing a null pointer.
> 
> Signed-off-by: Nia Alarie <nia.alarie@gmail.com>

Applied to ppc-for-2.12, thanks.

> ---
>  hw/ppc/e500.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index a40d3ec3e3..6ce03d6ff4 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -1005,6 +1005,10 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
>          }
>      }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +    if (!filename) {
> +        error_report("Could not find firmware '%s'", bios_name);
> +        exit(1);
> +    }
>  
>      bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
>                           1, PPC_ELF_MACHINE, 0, 0);

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

* Re: [Qemu-devel] [PATCH] PPC: e500: Add check for NULL return value from qemu_find_file.
  2018-03-04 23:51 ` David Gibson
@ 2018-03-05  1:38   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2018-03-05  1:38 UTC (permalink / raw)
  To: Nia Alarie; +Cc: qemu-devel, qemu-ppc, agraf, stefanha, jim, joel

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

On Mon, Mar 05, 2018 at 10:51:52AM +1100, David Gibson wrote:
> On Sat, Mar 03, 2018 at 01:02:26PM +0000, Nia Alarie wrote:
> > This prints a message and exits if the e500 BIOS firmware can't
> > be found, to avoid dereferencing a null pointer.
> > 
> > Signed-off-by: Nia Alarie <nia.alarie@gmail.com>
> 
> Applied to ppc-for-2.12, thanks.

Sorry, I take that back.  This has been obsoleted by other changes to
the e500 image load path.
> 
> > ---
> >  hw/ppc/e500.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> > index a40d3ec3e3..6ce03d6ff4 100644
> > --- a/hw/ppc/e500.c
> > +++ b/hw/ppc/e500.c
> > @@ -1005,6 +1005,10 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
> >          }
> >      }
> >      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> > +    if (!filename) {
> > +        error_report("Could not find firmware '%s'", bios_name);
> > +        exit(1);
> > +    }
> >  
> >      bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
> >                           1, PPC_ELF_MACHINE, 0, 0);
> 



-- 
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:[~2018-03-05  1:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-03 13:02 [Qemu-devel] [PATCH] PPC: e500: Add check for NULL return value from qemu_find_file Nia Alarie
2018-03-04 23:51 ` David Gibson
2018-03-05  1:38   ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.