]> Git Repo - qemu.git/commitdiff
hw/sparc/leon3: Don't call get_image_size() on a NULL pointer
authorPeter Maydell <[email protected]>
Fri, 5 Aug 2016 10:03:59 +0000 (11:03 +0100)
committerPeter Maydell <[email protected]>
Mon, 8 Aug 2016 12:58:42 +0000 (13:58 +0100)
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 <[email protected]>
Message-id: 1470391439[email protected]

hw/sparc/leon3.c

index dbae41f3a4dfc4d1ed2e46b850606c971592aa15..6e1647841364bb0b4a7dc4be7a7df25f5d41e41b 100644 (file)
@@ -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",
This page took 0.026455 seconds and 4 git commands to generate.