"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

qfw: Fix segfault from uninitialized variables in sandbox

There are cases where qfw_read_entry() does not set the output parameter
passed by address. This occurs with qfw_sandbox_read_entry_dma, which
leaves the size variables uninitialized and causes a segfault when running
bootflow scan in U-Boot sandbox.

$ ./u-boot
...
U-Boot 2026.01-rc1-00199-gc2637036b8f0 (Nov 04 2025 - 10:32:21 +0100)
...
Hit any key to stop autoboot: 0
=> bootflow scan
efi_var_to_file() Cannot persist EFI variables without system partition
efi_tcg2_register() Missing TPMv2 device for EFI_TCG_PROTOCOL
efi_rng_register() Missing RNG device for EFI_RNG_PROTOCOL
scanning bus for devices...
[3] 1015761 segmentation fault (core dumped) ./u-boot

Initalize all these variables to 0 to fix this issue.

Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>

authored by

Kory Maincent (TI.com) and committed by
Tom Rini
664cdc5f c7e33aae

+1 -1
+1 -1
common/qfw.c
··· 109 109 ulong initrd_addr) 110 110 { 111 111 char *data_addr; 112 - u32 setup_size, kernel_size, cmdline_size, initrd_size; 112 + u32 setup_size = 0, kernel_size = 0, cmdline_size = 0, initrd_size = 0; 113 113 114 114 qfw_read_entry(qfw_dev, FW_CFG_SETUP_SIZE, 4, &setup_size); 115 115 qfw_read_entry(qfw_dev, FW_CFG_KERNEL_SIZE, 4, &kernel_size);