@samitouri / QOSamiQemu / commits / 76dbe26fd6

hw/sparc64/niagara: use int64_t for vdisk size to avoid truncation

blk_getlength() returns int64_t, but niagara_init() stored it in an int, truncating the if=pflash virtual-ramdisk size for images >= 2 GiB. A ~4 GiB image truncated to 0/negative, failed the `size > 0` check, and exit(1)'d before the CPU ran, ending with: qemu-system-sparc64: could not load ram disk Signed-off-by: Dmitry Pimenov <sun4qemu@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Message-ID: <20260710222350.9185-1-sun4qemu@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

Dmitry Pimenov committed Jul 11, 2026 at 00:23 UTC 76dbe26fd6500a94b85bf0f3a39d73b72f5fab7b
1 file changed +1 -1
hw/sparc64/niagara.c
+1 -1
@@ -137,7 +137,7 @@ static void niagara_init(MachineState *machine)
137 outside of the partition RAM */
138 if (dinfo) {
139 BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
140 - int size = blk_getlength(blk);
140 + int64_t size = blk_getlength(blk);
141 if (size > 0) {
142 memory_region_init_ram(&s->vdisk_ram, NULL, "sun4v_vdisk.ram", size,
143 &error_fatal);