[scan-admin at coverity.com: New Defects reported by Coverity Scan for Das U-Boot]

Asherah Connor ashe at kivikakk.ee
Tue Apr 20 02:58:28 CEST 2021


Looking at cmd/qfw.c as I touched it last:

On 21/04/19 08:04:p, Tom Rini wrote:
> ** CID 331156:  Incorrect expression  (UNUSED_VALUE)
> /cmd/qfw.c: 40 in qemu_fwcfg_cmd_setup_kernel()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 331156:  Incorrect expression  (UNUSED_VALUE)
> /cmd/qfw.c: 40 in qemu_fwcfg_cmd_setup_kernel()
> 34     	qfw_read_entry(qfw_dev, FW_CFG_SETUP_DATA,
> 35     		       le32_to_cpu(setup_size), data_addr);
> 36     	data_addr += le32_to_cpu(setup_size);
> 37     
> 38     	qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA,
> 39     		       le32_to_cpu(kernel_size), data_addr);
> >>>     CID 331156:  Incorrect expression  (UNUSED_VALUE)
> >>>     Assigning value from "(__u32)(__le32)kernel_size" to "data_addr" here, but that stored value is overwritten before it can be used.
> 40     	data_addr += le32_to_cpu(kernel_size);
> 41     
> 42     	data_addr = initrd_addr;
> 43     	qfw_read_entry(qfw_dev, FW_CFG_INITRD_SIZE, 4, &initrd_size);
> 44     	if (initrd_size == 0) {
> 45     		printf("warning: no initrd available\n");

This is unchanged since 2016 and I think is fine to leave as-is.  The
data_addr increment goes together with the qfw_read_entry() to keep
advancing the data_addr pointer correctly.

It does get immediately thrown away in this case, but if we moved any
part of this around or changed it we'd want to keep it, so the warning
is likely best ignored.

Asherah


More information about the U-Boot mailing list