Fwd: New Defects reported by Coverity Scan for efi_capsule.c

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Apr 19 13:59:39 CEST 2021


Dear Sughosh, Takahiro, Jose,

could you please, look into the issues below.



-------- Forwarded Message --------
Subject: New Defects reported by Coverity Scan for Das U-Boot
Date: Mon, 19 Apr 2021 01:18:38 +0000 (UTC)
From: scan-admin at coverity.com
To: xypron.glpk at gmx.de

Hi,

Please find the latest report on new defect(s) introduced to Das U-Boot
found with Coverity Scan.

13 new defect(s) introduced to Das U-Boot found with Coverity Scan.
5 defect(s), reported by Coverity Scan earlier, were marked fixed in the
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 13 of 13 defect(s)


** CID 331153:  Code maintainability issues  (UNUSED_VALUE)
/lib/efi_loader/efi_capsule.c: 661 in find_boot_device()


________________________________________________________________________________________________________
*** CID 331153:  Code maintainability issues  (UNUSED_VALUE)
/lib/efi_loader/efi_capsule.c: 661 in find_boot_device()
655     	size = 0;
656     	ret = efi_get_variable_int(L"BootOrder", &efi_global_variable_guid,
657     				   NULL, &size, NULL, NULL);
658     	if (ret == EFI_BUFFER_TOO_SMALL) {
659     		boot_order = malloc(size);
660     		if (!boot_order) {
>>>     CID 331153:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value "9223372036854775817UL" to "ret" here, but that stored value is overwritten before it can be used.
661     			ret = EFI_OUT_OF_RESOURCES;

@Sughosh, Takahiro
The logic after out: should consider ret. Maybe just move the label
further down.

662     			goto out;
663     		}
664     665     		ret = efi_get_variable_int(L"BootOrder",
666     					   &efi_global_variable_guid,



** CID 331147:  Code maintainability issues  (UNUSED_VALUE)
/lib/efi_loader/efi_capsule.c: 456 in efi_update_capsule()


________________________________________________________________________________________________________
*** CID 331147:  Code maintainability issues  (UNUSED_VALUE)
/lib/efi_loader/efi_capsule.c: 456 in efi_update_capsule()
450     	efi_status_t ret;
451     452     	EFI_ENTRY("%p, %zu, %llu\n", capsule_header_array,
capsule_count,
453     		  scatter_gather_list);
454     455     	if (!capsule_count) {
>>>     CID 331147:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value "9223372036854775810UL" to "ret" here, but that stored value is overwritten before it can be used.
456     		ret = EFI_INVALID_PARAMETER;

@Jose
Calling efi_esrt_populate() in this case might not be the right thing to do.

457     		goto out;
458     	}
459     460     	ret = EFI_SUCCESS;
461     	for (i = 0, capsule = *capsule_header_array; i < capsule_count;

Best regards

Heinrich



More information about the U-Boot mailing list