Hi,

Please find the latest report on new defect(s) introduced to coreboot found 
with Coverity Scan.

12 new defect(s) introduced to coreboot found with Coverity Scan.
1 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 12 of 12 defect(s)


** CID 1371825:  Uninitialized variables  (UNINIT)
/src/mainboard/intel/kblrvp/romstage.c: 58 in mainboard_memory_init_params()


________________________________________________________________________________________________________
*** CID 1371825:  Uninitialized variables  (UNINIT)
/src/mainboard/intel/kblrvp/romstage.c: 58 in mainboard_memory_init_params()
52      } else {  /* for CONFIG_BOARD_INTEL_KBLRVP7 */
53              struct spd_block blk;
54     
55              mem_cfg->DqPinsInterleaved = 1;
56              get_spd_smbus(&blk);
57              mem_cfg->MemorySpdDataLen = blk.len;
>>>     CID 1371825:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized element of array "blk.spd_array".
58              mem_cfg->MemorySpdPtr00 = (u32)blk.spd_array[0];
59      }
60      mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00;

** CID 1371824:  Control flow issues  (NO_EFFECT)
/src/lib/spd_bin.c: 160 in get_spd_smbus()


________________________________________________________________________________________________________
*** CID 1371824:  Control flow issues  (NO_EFFECT)
/src/lib/spd_bin.c: 160 in get_spd_smbus()
154     
155     void get_spd_smbus(struct spd_block *blk)
156     {
157             u8 i;
158             unsigned char *spd_data_ptr = car_get_var_ptr(&spd_data);
159     
>>>     CID 1371824:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "i < 
>>> 0".
160             for (i = 0 ; i < CONFIG_DIMM_MAX; i++) {
161                     get_spd(spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE,
162                             0xA0 + (i << 1));
163                     blk->spd_array[i] = spd_data_ptr + i * 
CONFIG_DIMM_SPD_SIZE;
164             }
165     

** CID 1371823:  Control flow issues  (NO_EFFECT)
/src/lib/spd_bin.c: 104 in update_spd_len()


________________________________________________________________________________________________________
*** CID 1371823:  Control flow issues  (NO_EFFECT)
/src/lib/spd_bin.c: 104 in update_spd_len()
98      }
99     }
100     
101     static void update_spd_len(struct spd_block *blk)
102     {
103             u8 i, j = 0;
>>>     CID 1371823:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "i < 
>>> 0".
104             for (i = 0 ; i < CONFIG_DIMM_MAX; i++)
105                     if (blk->spd_array[i] != NULL)
106                             j |= blk->spd_array[i][SPD_DRAM_TYPE];
107     
108             /* If spd used is DDR4, then its length is 512 byte. */
109             if (j == SPD_DRAM_DDR4)

** CID 1371822:  Control flow issues  (NO_EFFECT)
/src/lib/spd_bin.c: 30 in dump_spd_info()


________________________________________________________________________________________________________
*** CID 1371822:  Control flow issues  (NO_EFFECT)
/src/lib/spd_bin.c: 30 in dump_spd_info()
24     static u8 spd_data[CONFIG_DIMM_MAX * CONFIG_DIMM_SPD_SIZE] CAR_GLOBAL;
25     
26     void dump_spd_info(struct spd_block *blk)
27     {
28      u8 i;
29     
>>>     CID 1371822:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "i < 
>>> 0".
30      for (i = 0; i < CONFIG_DIMM_MAX; i++)
31              if (blk->spd_array[i] != NULL && blk->spd_array[i][0] != 0) {
32                      printk(BIOS_DEBUG, "SPD @ 0x%02X\n", 0xA0|(i << 1));
33                      print_spd_info(blk->spd_array[i]);
34              }
35     }

** CID 1371821:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 105 in update_spd_len()


________________________________________________________________________________________________________
*** CID 1371821:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 105 in update_spd_len()
99     }
100     
101     static void update_spd_len(struct spd_block *blk)
102     {
103             u8 i, j = 0;
104             for (i = 0 ; i < CONFIG_DIMM_MAX; i++)
>>>     CID 1371821:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "if (blk->spd_array[i] != NU...".
105                     if (blk->spd_array[i] != NULL)
106                             j |= blk->spd_array[i][SPD_DRAM_TYPE];
107     
108             /* If spd used is DDR4, then its length is 512 byte. */
109             if (j == SPD_DRAM_DDR4)
110                     blk->len = SPD_PAGE_LEN_DDR4;

** CID 1371820:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 161 in get_spd_smbus()


________________________________________________________________________________________________________
*** CID 1371820:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 161 in get_spd_smbus()
155     void get_spd_smbus(struct spd_block *blk)
156     {
157             u8 i;
158             unsigned char *spd_data_ptr = car_get_var_ptr(&spd_data);
159     
160             for (i = 0 ; i < CONFIG_DIMM_MAX; i++) {
>>>     CID 1371820:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "get_spd(spd_data_ptr + i * ...".
161                     get_spd(spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE,
162                             0xA0 + (i << 1));
163                     blk->spd_array[i] = spd_data_ptr + i * 
CONFIG_DIMM_SPD_SIZE;
164             }
165     
166             update_spd_len(blk);

** CID 1371819:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 110 in update_spd_len()


________________________________________________________________________________________________________
*** CID 1371819:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 110 in update_spd_len()
104             for (i = 0 ; i < CONFIG_DIMM_MAX; i++)
105                     if (blk->spd_array[i] != NULL)
106                             j |= blk->spd_array[i][SPD_DRAM_TYPE];
107     
108             /* If spd used is DDR4, then its length is 512 byte. */
109             if (j == SPD_DRAM_DDR4)
>>>     CID 1371819:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "blk->len = 512;".
110                     blk->len = SPD_PAGE_LEN_DDR4;
111             else
112                     blk->len = SPD_PAGE_LEN;
113     }
114     
115     int get_spd_cbfs_rdev(struct region_device *spd_rdev, u8 spd_index)

** CID 1371818:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 31 in dump_spd_info()


________________________________________________________________________________________________________
*** CID 1371818:  Control flow issues  (DEADCODE)
/src/lib/spd_bin.c: 31 in dump_spd_info()
25     
26     void dump_spd_info(struct spd_block *blk)
27     {
28      u8 i;
29     
30      for (i = 0; i < CONFIG_DIMM_MAX; i++)
>>>     CID 1371818:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "if (blk->spd_array[i] != NU...".
31              if (blk->spd_array[i] != NULL && blk->spd_array[i][0] != 0) {
32                      printk(BIOS_DEBUG, "SPD @ 0x%02X\n", 0xA0|(i << 1));
33                      print_spd_info(blk->spd_array[i]);
34              }
35     }
36     

** CID 1371817:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/src/lib/spd_bin.c: 104 in update_spd_len()


________________________________________________________________________________________________________
*** CID 1371817:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/src/lib/spd_bin.c: 104 in update_spd_len()
98      }
99     }
100     
101     static void update_spd_len(struct spd_block *blk)
102     {
103             u8 i, j = 0;
>>>     CID 1371817:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "i < 0" is always false regardless of the values of its operands. This 
>>> occurs as the logical operand of "for".
104             for (i = 0 ; i < CONFIG_DIMM_MAX; i++)
105                     if (blk->spd_array[i] != NULL)
106                             j |= blk->spd_array[i][SPD_DRAM_TYPE];
107     
108             /* If spd used is DDR4, then its length is 512 byte. */
109             if (j == SPD_DRAM_DDR4)

** CID 1371816:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/src/lib/spd_bin.c: 160 in get_spd_smbus()


________________________________________________________________________________________________________
*** CID 1371816:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/src/lib/spd_bin.c: 160 in get_spd_smbus()
154     
155     void get_spd_smbus(struct spd_block *blk)
156     {
157             u8 i;
158             unsigned char *spd_data_ptr = car_get_var_ptr(&spd_data);
159     
>>>     CID 1371816:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "i < 0" is always false regardless of the values of its operands. This 
>>> occurs as the logical operand of "for".
160             for (i = 0 ; i < CONFIG_DIMM_MAX; i++) {
161                     get_spd(spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE,
162                             0xA0 + (i << 1));
163                     blk->spd_array[i] = spd_data_ptr + i * 
CONFIG_DIMM_SPD_SIZE;
164             }
165     

** CID 1371815:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/src/lib/spd_bin.c: 30 in dump_spd_info()


________________________________________________________________________________________________________
*** CID 1371815:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/src/lib/spd_bin.c: 30 in dump_spd_info()
24     static u8 spd_data[CONFIG_DIMM_MAX * CONFIG_DIMM_SPD_SIZE] CAR_GLOBAL;
25     
26     void dump_spd_info(struct spd_block *blk)
27     {
28      u8 i;
29     
>>>     CID 1371815:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "i < 0" is always false regardless of the values of its operands. This 
>>> occurs as the logical operand of "for".
30      for (i = 0; i < CONFIG_DIMM_MAX; i++)
31              if (blk->spd_array[i] != NULL && blk->spd_array[i][0] != 0) {
32                      printk(BIOS_DEBUG, "SPD @ 0x%02X\n", 0xA0|(i << 1));
33                      print_spd_info(blk->spd_array[i]);
34              }
35     }

** CID 1371814:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
/src/soc/intel/common/smbios.c: 31 in dimm_info_fill()


________________________________________________________________________________________________________
*** CID 1371814:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
/src/soc/intel/common/smbios.c: 31 in dimm_info_fill()
25     {
26      dimm->dimm_size = dimm_capacity;
27      dimm->ddr_type = ddr_type;
28      dimm->ddr_frequency = frequency;
29      dimm->channel_num = channel_id;
30      dimm->dimm_num = dimm_id;
>>>     CID 1371814:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
>>>     Calling strncpy with a maximum size argument of 19 bytes on destination 
>>> array "dimm->module_part_number" of size 19 bytes might leave the 
>>> destination string unterminated.
31      strncpy((char *)dimm->module_part_number,
32                      module_part_num,
33                      sizeof(dimm->module_part_number));
34      switch (data_width) {
35      case 8:
36              dimm->bus_width = MEMORY_BUS_WIDTH_8;


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, 
https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbLuoVetFLSjdonCi1EjfHRqWGQvojmmkYaBE-2BPJiTQvQ-3D-3D_q4bX76XMySz3BXBlWr5fXXJ4cvAsgEXEqC7dBPM7O5bQ628PfrOPmna3sbO51pO2xPctEShvrwCkBSSMVdvtg7qGH2br6TGccmTHZV3nYrlSEdLtwMgdnauTv-2Fu5Qm4LHDnYmgZPYbR3dE6dP9ZaGUalg4ozwoP8gP5WQnIQcvbcucsDsilcvvr4MerpJdvfLBrr7PKJJAYpyYRMea2zpvZi39QjZpUo6ncW9dYE9Vw-3D

To manage Coverity Scan email notifications for "[email protected]", click 
https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4e-2BpBzwOa5gzBZa9dWpDbzfofODnVj1enK2UkK0-2BgCCqyeem8IVKvTxSaOFkteZFcnohwvb2rnYNjswGryEWCURnUk6WHU42sbOmtOjD-2Bx5c-3D_q4bX76XMySz3BXBlWr5fXXJ4cvAsgEXEqC7dBPM7O5bQ628PfrOPmna3sbO51pO2C-2BaG0xvvh-2BduyG9h6BsXv0GQUPxIoGIH4muLDuFKSN-2BHEFFj8ObXxoCIGGcER8yPtXLcFC78NKwU1s0xvSVuht-2FI72uBLkpv0CsNdZ23EjLKu9GCml-2By0yqIsqWEvAkjFy57wWTRlHZakvvJahK8dxai85bewrSSKk7DEZ5YMR4-3D


-- 
coreboot mailing list: [email protected]
https://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to