aboutsummaryrefslogtreecommitdiff
path: root/hw/sparc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-08-05 11:03:59 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-08-08 13:58:42 +0100
commit47dc0ec576c3d8748985e34d273c8dc0465c5ddb (patch)
tree8f5d995ce46474c67d5626c2810959fa04705fa5 /hw/sparc
parentf5edfcfafbc0fbe2e2270b9fbcbf9009399bc27a (diff)
hw/sparc/leon3: Don't call get_image_size() on a NULL pointer
get_image_size() doesn't handle being passed a NULL pointer, so avoid doing that. Spotted by the clang ub sanitizer (which notices the attempt to pass NULL to open()). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1470391439-28427-1-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'hw/sparc')
-rw-r--r--hw/sparc/leon3.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index dbae41f3a4..6e16478413 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -171,7 +171,11 @@ static void leon3_generic_hw_init(MachineState *machine)
}
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
- bios_size = get_image_size(filename);
+ if (filename) {
+ bios_size = get_image_size(filename);
+ } else {
+ bios_size = -1;
+ }
if (bios_size > prom_size) {
fprintf(stderr, "qemu: could not load prom '%s': file too big\n",