qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Nia Alarie <nia.alarie@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de,
	stefanha@gmail.com, jim@groklearning.com, joel@jms.id.au
Subject: Re: [Qemu-devel] [PATCH] PPC: e500: Add check for NULL return value from qemu_find_file.
Date: Mon, 5 Mar 2018 10:51:52 +1100	[thread overview]
Message-ID: <20180304235152.GA2650@umbus.fritz.box> (raw)
In-Reply-To: <20180303130226.26906-1-nia.alarie@gmail.com>

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

  reply	other threads:[~2018-03-05  0:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-03-05  1:38   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180304235152.GA2650@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=nia.alarie@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).