Skip to contentSkip to conversation

New Defects reported by Coverity Scan for Das U-Boot

DISCUSSION Tom Rini 1 participant 1 message Nov 23

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

Here's the report from v2027.01-rc3. Looks like the AVB update introduced a few issues, or at least things to investigate. Thanks!

---------- Forwarded message ---------
From: <[email protected]>
Date: Mon, Nov 23, 2026 at 4:33 PM
Subject: New Defects reported by Coverity Scan for Das U-Boot
To: <[email protected]>

Hi,

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

- *New Defects Found:* 5
- 9 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
- *Defects Shown:* Showing 5 of 5 defect(s)

Defect Details

** CID 662464: Memory - illegal accesses (UNINIT)

_____________________________________________________________________________________________
*** CID 662464: Memory - illegal accesses (UNINIT)
/lib/libavb/avb_slot_verify.c: 450 in
load_and_verify_hash_partition()
444 &slot_data->loaded_partitions[slot_data->num_loaded_partitions++];
445 loaded_partition->digest = avb_calloc(digest_len);
446 if (loaded_partition->digest == NULL) {
447 ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
448 goto fail;
449 }

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 662464: Memory - illegal accesses (UNINIT)
Using uninitialized value "digest" when calling "avb_memcpy".

450         avb_memcpy(loaded_partition->digest, digest, digest_len);
451         loaded_partition->digest_size = digest_len;
452         loaded_partition->digest_type = digest_type;
453         loaded_partition->partition_name = avb_strdup(found);
454         loaded_partition->data_size = image_size;
455         loaded_partition->data = image_buf;

** CID 662463: Uninitialized variables (UNINIT)
/lib/libavb/avb_slot_verify.c: 452 in load_and_verify_hash_partition()

_____________________________________________________________________________________________
*** CID 662463: Uninitialized variables (UNINIT)
/lib/libavb/avb_slot_verify.c: 452 in
load_and_verify_hash_partition()
446 if (loaded_partition->digest == NULL) {
447 ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
448 goto fail;

449         }
450         avb_memcpy(loaded_partition->digest, digest, digest_len);
451         loaded_partition->digest_size = digest_len;
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 662463: Uninitialized variables (UNINIT)
Using uninitialized value "digest_type".

452         loaded_partition->digest_type = digest_type;
453         loaded_partition->partition_name = avb_strdup(found);
454         loaded_partition->data_size = image_size;
455         loaded_partition->data = image_buf;
456         loaded_partition->preloaded = image_preloaded;
457         loaded_partition->verify_result = ret;

** CID 662462: Uninitialized variables (UNINIT)

_____________________________________________________________________________________________
*** CID 662462: Uninitialized variables (UNINIT)
/lib/libavb/avb_slot_verify.c: 445 in
load_and_verify_hash_partition()

439           avb_error(part_name, ": Too many loaded partitions.\n");
440           ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
441           goto fail;

442 }
443 loaded_partition =
444 &slot_data->loaded_partitions[slot_data->num_loaded_partitions++];

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 662462: Uninitialized variables (UNINIT)
Using uninitialized value "digest_len" when calling "avb_calloc".

445 loaded_partition->digest = avb_calloc(digest_len);
446 if (loaded_partition->digest == NULL) {
447 ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
448 goto fail;
449 }
450 avb_memcpy(loaded_partition->digest, digest, digest_len);

** CID 536494: Integer handling issues (INTEGER_OVERFLOW)
/include/linux/log2.h: 72 in __rounddown_pow_of_two()

_____________________________________________________________________________________________
*** CID 536494: Integer handling issues (INTEGER_OVERFLOW)
/include/linux/log2.h: 72 in __rounddown_pow_of_two()

66      * __rounddown_pow_of_two() - round down to nearest power of two
67      * @n: value to round down
68      */
69     static inline __attribute__((const))
70     unsigned long __rounddown_pow_of_two(unsigned long n)
71     {
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 536494: Integer handling issues (INTEGER_OVERFLOW)
Expression "fls_long(n) - 1U", where "fls_long(n)" is known to be equal to 0, underflows the type of "fls_long(n) - 1U", which is type "unsigned int".

72 return 1UL << (fls_long(n) - 1);
73 }
74
75 /**
76 * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value
77 * @n: parameter

** CID 243627: Integer handling issues (BAD_SHIFT)
/include/linux/log2.h: 72 in __rounddown_pow_of_two()

_____________________________________________________________________________________________
*** CID 243627: Integer handling issues (BAD_SHIFT)
/include/linux/log2.h: 72 in __rounddown_pow_of_two()

66      * __rounddown_pow_of_two() - round down to nearest power of two
67      * @n: value to round down
68      */
69     static inline __attribute__((const))
70     unsigned long __rounddown_pow_of_two(unsigned long n)
71     {
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 243627: Integer handling issues (BAD_SHIFT)
In expression "1UL << fls_long(n) - 1U", left shifting by more than 63 bits has undefined behavior. The shift amount, "fls_long(n) - 1U", is 4294967295.

72 return 1UL << (fls_long(n) - 1);
73 }
74
75 /**
76 * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value
77 * @n: parameter

View Defects in Coverity Scan
<https://scan.coverity.com/projects/das-u-boot?tab=overview>

Best regards,

The Coverity Scan Admin Team

----- End forwarded message -----

Signature · 1 line
Tom