Hi,

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

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


** CID 1461240:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/core/cortex-m/watchdog.c: 37 in watchdog_trace()


________________________________________________________________________________________________________
*** CID 1461240:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/core/cortex-m/watchdog.c: 37 in watchdog_trace()
31     
32      /*
33       * This is our last breath, the last opportunity to sort out all
34       * matters. Flush and invalidate D-cache if cache enabled.
35       */
36      if (IS_ENABLED(CONFIG_ARMV7M_CACHE))
>>>     CID 1461240:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "cpu_clean_invalidate_dcache();".
37              cpu_clean_invalidate_dcache();
38     
39      panic_printf("### WATCHDOG PC=%08x / LR=%08x / pSP=%08x ",
40                   stack[6], stack[5], psp);
41      if ((excep_lr & 0xf) == 1)
42              panic_puts("(exc) ###\n");

** CID 1461239:    (PARSE_ERROR)
/3rdparty/chromeec/common/shared_mem.c: 19 in ()
/3rdparty/chromeec/common/shared_mem.c: 19 in ()
/3rdparty/chromeec/common/shared_mem.c: 19 in ()


________________________________________________________________________________________________________
*** CID 1461239:    (PARSE_ERROR)
/3rdparty/chromeec/common/shared_mem.c: 19 in ()
13     #include "util.h"
14     
15     static int buf_in_use;
16     static int max_used;
17     
18     /* 1 MB buffer for fake shared memory implementation */
>>>     CID 1461239:    (PARSE_ERROR)
>>>     expression must be an integral constant expression
19     STATIC_IF(CONFIG_FAKE_SHMEM) char fake_shmem_buf[BIT(20)];
20     
21     int shared_mem_size(void)
22     {
23      if (IS_ENABLED(CONFIG_FAKE_SHMEM))
24              return sizeof(fake_shmem_buf);
/3rdparty/chromeec/common/shared_mem.c: 19 in ()
13     #include "util.h"
14     
15     static int buf_in_use;
16     static int max_used;
17     
18     /* 1 MB buffer for fake shared memory implementation */
>>>     CID 1461239:    (PARSE_ERROR)
>>>     function call is not allowed in a constant expression
19     STATIC_IF(CONFIG_FAKE_SHMEM) char fake_shmem_buf[BIT(20)];
20     
21     int shared_mem_size(void)
22     {
23      if (IS_ENABLED(CONFIG_FAKE_SHMEM))
24              return sizeof(fake_shmem_buf);
/3rdparty/chromeec/common/shared_mem.c: 19 in ()
13     #include "util.h"
14     
15     static int buf_in_use;
16     static int max_used;
17     
18     /* 1 MB buffer for fake shared memory implementation */
>>>     CID 1461239:    (PARSE_ERROR)
>>>     expression must have integral type
19     STATIC_IF(CONFIG_FAKE_SHMEM) char fake_shmem_buf[BIT(20)];
20     
21     int shared_mem_size(void)
22     {
23      if (IS_ENABLED(CONFIG_FAKE_SHMEM))
24              return sizeof(fake_shmem_buf);

** CID 1461238:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 1312 in svdm_dp_post_config()


________________________________________________________________________________________________________
*** CID 1461238:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 1312 in svdm_dp_post_config()
1306     
1307     __overridable void svdm_dp_post_config(int port)
1308     {
1309            mux_state_t mux_mode = svdm_dp_get_mux_mode(port);
1310            /* Connect the SBU and USB lines to the connector. */
1311            if (IS_ENABLED(CONFIG_USBC_PPC_SBU))
>>>     CID 1461238:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "ppc_set_sbu(port, 1);".
1312                    ppc_set_sbu(port, 1);
1313            usb_mux_set(port, mux_mode, USB_SWITCH_CONNECT,
1314                    polarity_rm_dts(pd_get_polarity(port)));
1315     
1316            dp_flags[port] |= DP_FLAGS_DP_ON;
1317            if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING))

** CID 1461237:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/motion_sense.c: 446 in 
motion_sense_switch_sensor_rate()


________________________________________________________________________________________________________
*** CID 1461237:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/motion_sense.c: 446 in 
motion_sense_switch_sensor_rate()
440                     /* No sensor activated, reset host interval interval to 
0. */
441                     ap_event_interval = 0;
442             }
443     
444             /* disable the body detection since AP is suspended */
445             if (IS_ENABLED(CONFIG_BODY_DETECTION)) {
>>>     CID 1461237:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "static _Bool was_enabled;".
446                     static bool was_enabled;
447     
448                     switch (sensor_active) {
449                     case SENSOR_ACTIVE_S3:
450                             was_enabled = body_detect_get_enable();
451                             body_detect_set_enable(false);

** CID 1461236:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/3rdparty/chromeec/common/chargen.c: 95 in command_chargen()


________________________________________________________________________________________________________
*** CID 1461236:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/3rdparty/chromeec/common/chargen.c: 95 in command_chargen()
89                              continue;
90     
91                      watchdog_reload();
92                      prev_watchdog_time.val = current_time.val;
93              }
94     
>>>     CID 1461236:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "({...; 0;}) && c == 48" is always false regardless of the values of 
>>> its operands. This occurs as the logical operand of "if".
95              if (IS_ENABLED(CONFIG_ZEPHYR) && c == '0')
96                      watchdog_reload();
97     
98              putc_(c++);
99     
100                     if (seq_number && (++seq_counter == seq_number))

** CID 1461235:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/panic_output.c: 182 in get_panic_data_start()


________________________________________________________________________________________________________
*** CID 1461235:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/panic_output.c: 182 in get_panic_data_start()
176     uintptr_t get_panic_data_start(void)
177     {
178             if (pdata_ptr->magic != PANIC_DATA_MAGIC)
179                     return 0;
180     
181             if (IS_ENABLED(CONFIG_ZEPHYR))
>>>     CID 1461235:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return (uintptr_t)pdata_ptr;".
182                     return (uintptr_t)pdata_ptr;
183     
184             return ((uintptr_t)CONFIG_PANIC_DATA_BASE
185                                + CONFIG_PANIC_DATA_SIZE
186                                - pdata_ptr->struct_size);
187     }

** CID 1461234:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/system.c: 850 in system_get_board_version()


________________________________________________________________________________________________________
*** CID 1461234:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/system.c: 850 in system_get_board_version()
844      */
845     int system_get_board_version(void)
846     {
847             int board_id;
848     
849             if (IS_ENABLED(CONFIG_BOARD_VERSION_CBI)) {
>>>     CID 1461234:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "int error;".
850                     int error;
851     
852                     error = cbi_get_board_version(&board_id);
853                     if (error)
854                             return -error;
855     

** CID 1461233:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/charge_manager.c: 418 in 
charge_manager_fill_power_info()


________________________________________________________________________________________________________
*** CID 1461233:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/charge_manager.c: 418 in 
charge_manager_fill_power_info()
412                             r->type = USB_CHG_TYPE_NONE;
413                             r->meas.voltage_max = 0;
414                             r->meas.voltage_now =
415                                     r->role == USB_PD_PORT_POWER_SOURCE ? 
5000 : 0;
416                             /* TCPMv2 tracks source-out current in the DPM 
*/
417                             if (IS_ENABLED(CONFIG_USB_PD_TCPMV2))
>>>     CID 1461233:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "r->meas.current_max = dpm_g...".
418                                     r->meas.current_max =
419                                             dpm_get_source_current(port);
420                             else
421                                     r->meas.current_max =
422                                             
charge_manager_get_source_current(port);
423                             r->max_power = 0;

** CID 1461232:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 896 in 
is_tbt_cable_superspeed()


________________________________________________________________________________________________________
*** CID 1461232:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 896 in 
is_tbt_cable_superspeed()
890             if (disc->identity.idh.product_type == IDH_PTYPE_ACABLE)
891                     return true;
892     
893             if (disc->identity.idh.product_type != IDH_PTYPE_PCABLE)
894                     return false;
895     
>>>     CID 1461232:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "({...; 0;}) && is_pd_rev3(port, TCPC_TX_SOP_PRIME)" is always false 
>>> regardless of the values of its operands. This occurs as the logical 
>>> operand of "if".
896             if (IS_ENABLED(CONFIG_USB_PD_REV30) &&
897                is_pd_rev3(port, TCPC_TX_SOP_PRIME))
898                     return  disc->identity.product_t1.p_rev30.ss ==
899                                                     USB_R30_SS_U32_U40_GEN1 
||
900                             disc->identity.product_t1.p_rev30.ss ==
901                                                     USB_R30_SS_U32_U40_GEN2 
||

** CID 1461231:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_common.c: 542 in usb_mux_set_safe_mode_exit()


________________________________________________________________________________________________________
*** CID 1461231:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_common.c: 542 in usb_mux_set_safe_mode_exit()
536             if (IS_ENABLED(CONFIG_USBC_SS_MUX))
537                     usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_CONNECT,
538                                 polarity_rm_dts(pd_get_polarity(port)));
539     
540             /* Isolate the SBU lines. */
541             if (IS_ENABLED(CONFIG_USBC_PPC_SBU))
>>>     CID 1461231:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "ppc_set_sbu(port, 0);".
542                     ppc_set_sbu(port, 0);
543     }
544     
545     static void pd_send_hard_reset(int port)
546     {
547             task_set_event(PD_PORT_TO_TASK_ID(port), 
PD_EVENT_SEND_HARD_RESET);

** CID 1461230:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 197 in pd_dfp_dp_get_pin_mode()


________________________________________________________________________________________________________
*** CID 1461230:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 197 in pd_dfp_dp_get_pin_mode()
191             /*
192              * Default dp_port_mf_allow is true, we allow mf operation
193              * if UFP_D supports it.
194              */
195     
196             if (IS_ENABLED(CONFIG_CMD_MFALLOW))
>>>     CID 1461230:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "mf_pref" inside this statement: 
>>> "mf_pref = (dp_status[port] ...".
197                     mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]) &&
198                             dp_port_mf_allow[port];
199             else
200                     mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
201     
202             if (!modep)

** CID 1461229:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/uart_buffering.c: 112 in uart_tx_char_raw()


________________________________________________________________________________________________________
*** CID 1461229:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/uart_buffering.c: 112 in uart_tx_char_raw()
106                     tx_next_snapshot_head = tx_buf_new_tail;
107     
108             tx_buf[tx_buf_head] = c;
109             tx_buf_head = tx_buf_next;
110     
111             if (IS_ENABLED(CONFIG_PRESERVE_LOGS))
>>>     CID 1461229:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "tx_checksum = uart_buffer_c...".
112                     tx_checksum = uart_buffer_calc_checksum();
113     #endif
114             return 0;
115     }
116     
117     #ifdef CONFIG_UART_TX_DMA

** CID 1461228:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/system.c: 126 in system_get_sku_id()


________________________________________________________________________________________________________
*** CID 1461228:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/system.c: 126 in system_get_sku_id()
120             return 0;
121     }
122     
123     uint32_t system_get_sku_id(void)
124     {
125             if (IS_ENABLED(CONFIG_HOSTCMD_AP_SET_SKUID))
>>>     CID 1461228:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return ap_sku_id;".
126                     return ap_sku_id;
127     
128             return board_get_sku_id();
129     }
130     
131     /**

** CID 1461227:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/charger.c: 460 in charger_discharge_on_ac()


________________________________________________________________________________________________________
*** CID 1461227:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/charger.c: 460 in charger_discharge_on_ac()
454     enum ec_error_list charger_discharge_on_ac(int enable)
455     {
456             int chgnum;
457             int rv = EC_ERROR_UNIMPLEMENTED;
458     
459             if (IS_ENABLED(CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM))
>>>     CID 1461227:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return board_discharge_on_a...".
460                     return board_discharge_on_ac(enable);
461     
462             /*
463              * When discharge on AC is selected, cycle through all chargers 
to
464              * enable or disable this feature.
465              */

** CID 1461226:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/core/cortex-m/panic.c: 427 in ignore_bus_fault()


________________________________________________________________________________________________________
*** CID 1461226:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/core/cortex-m/panic.c: 427 in ignore_bus_fault()
421                     exception_panic();
422     }
423     
424     void ignore_bus_fault(int ignored)
425     {
426             if (IS_ENABLED(CHIP_FAMILY_STM32H7)) {
>>>     CID 1461226:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "if (ignored == 0)
  asm("ds...".
427                     if (ignored == 0)
428                             asm volatile("dsb; isb");
429             }
430     
431             /*
432              * Flash code might call this before cpu_init(),

** CID 1461225:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/system.c: 333 in get_jump_data()


________________________________________________________________________________________________________
*** CID 1461225:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/system.c: 333 in get_jump_data()
327              */
328             if (IS_ENABLED(CONFIG_ZEPHYR)) {
329                     /*
330                      * For Zephyr, the panic data is not at the end of RAM 
so
331                      * the jump data is always at the end of RAM.
332                      */
>>>     CID 1461225:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "addr = 536903680U;".
333                     addr = CONFIG_RAM_BASE + CONFIG_RAM_SIZE;
334             } else {
335                     addr = get_panic_data_start();
336                     if (!addr)
337                             addr = CONFIG_RAM_BASE + CONFIG_RAM_SIZE;
338             }

** CID 1461224:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/keyboard_scan.c: 616 in board_keyboard_row_refresh()


________________________________________________________________________________________________________
*** CID 1461224:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/keyboard_scan.c: 616 in board_keyboard_row_refresh()
610     }
611     
612     static uint8_t keyboard_mask_refresh;
613     __overridable uint8_t board_keyboard_row_refresh(void)
614     {
615             if (IS_ENABLED(CONFIG_KEYBOARD_REFRESH_ROW3))
>>>     CID 1461224:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return 3;".
616                     return 3;
617             else
618                     return 2;
619     }
620     
621     #ifdef CONFIG_KEYBOARD_BOOT_KEYS

** CID 1461223:    (DEADCODE)
/3rdparty/chromeec/util/genvif.c: 3379 in init_vif_component_pd_source_fields()
/3rdparty/chromeec/util/genvif.c: 3384 in init_vif_component_pd_source_fields()


________________________________________________________________________________________________________
*** CID 1461223:    (DEADCODE)
/3rdparty/chromeec/util/genvif.c: 3379 in init_vif_component_pd_source_fields()
3373                            switch (resp) {
3374                            case 0:
3375                                    
set_vif_field(&vif_fields[PD_OCP_Method],
3376                                            
vif_component_name[PD_OCP_Method],
3377                                            "0", "Over-Current Response");
3378                                    break;
>>>     CID 1461223:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 1:".
3379                            case 1:
3380                                    
set_vif_field(&vif_fields[PD_OCP_Method],
3381                                            
vif_component_name[PD_OCP_Method],
3382                                            "1", "Under-Voltage Response");
3383                                    break;
3384                            case 2:
/3rdparty/chromeec/util/genvif.c: 3384 in init_vif_component_pd_source_fields()
3378                                    break;
3379                            case 1:
3380                                    
set_vif_field(&vif_fields[PD_OCP_Method],
3381                                            
vif_component_name[PD_OCP_Method],
3382                                            "1", "Under-Voltage Response");
3383                                    break;
>>>     CID 1461223:    (DEADCODE)
>>>     Execution cannot reach this statement: "case 2:".
3384                            case 2:
3385                                    
set_vif_field(&vif_fields[PD_OCP_Method],
3386                                            
vif_component_name[PD_OCP_Method],
3387                                            "2", "Both");
3388                                    break;
3389                            default:

** CID 1461222:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/3rdparty/chromeec/common/motion_sense.c: 970 in motion_sense_task()


________________________________________________________________________________________________________
*** CID 1461222:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/3rdparty/chromeec/common/motion_sense.c: 970 in motion_sense_task()
964                     /*
965                      * Ask the host to flush the queue if
966                      * - a flush event has been queued.
967                      * - the queue is almost full,
968                      * - we haven't done it for a while.
969                      */
>>>     CID 1461222:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "({...; 0;}) && (motion_sense_fifo_bypass_needed() || event & (768U /* 
>>> (1U << 8 + 1) / !!((1U << 8 + 1) & 65535) | (1U << 8) / !!((1U << 8) & 
>>> 65535) */) || motion_sense_fifo_over_thres() || (ap_event_interval > 0 && 
>>> time_after(ts_begin_task.le.lo, ts_last_int.le.lo + ap_event_interval)))" 
>>> is always false regardless of the values of its operands. This occurs as 
>>> the logical operand of "if".
970                     if (IS_ENABLED(CONFIG_ACCEL_FIFO) &&
971                         (motion_sense_fifo_bypass_needed() ||
972                          event & (TASK_EVENT_MOTION_ODR_CHANGE |
973                                   TASK_EVENT_MOTION_FLUSH_PENDING) ||
974                          motion_sense_fifo_over_thres() ||
975                          (ap_event_interval > 0 &&

** CID 1461221:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 1241 in svdm_dp_get_mux_mode()


________________________________________________________________________________________________________
*** CID 1461221:  Control flow issues  (DEADCODE)
/3rdparty/chromeec/common/usb_pd_alt_mode_dfp.c: 1241 in svdm_dp_get_mux_mode()
1235     {
1236            int pin_mode = get_dp_pin_mode(port);
1237            /* Default dp_port_mf_allow is true */
1238            int mf_pref;
1239     
1240            if (IS_ENABLED(CONFIG_CMD_MFALLOW))
>>>     CID 1461221:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "mf_pref" inside this statement: 
>>> "mf_pref = (dp_status[port] ...".
1241                    mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]) &&
1242                            dp_port_mf_allow[port];
1243            else
1244                    mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
1245     
1246            /*


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, 
https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yq2SfQfrHt3Prsn4qSLrYIrajINpiFX8l0vrlNSf8iCrS27qY0Cr0DkycwNUgGZJj8-3DhTNv_L-2FDzr14mnrsJO5b1wX1hp9b1MAQygl7x-2B74RAaH2cn0iTz8f77syA34rHA7ivMFTlUaDJ8cgMnD38CEeGadvKlWyZ2nWR67kRjQ2KZAY1a8bn9Nf-2BM0P4P6aWxQLG78itV-2B46vKBYQpvZL9syJGd5epOtngaYn9k1ecnsqjh90lVgFZdRc7Uo-2B39nZOb-2FwZKuKw0HPXYdHjz1-2Fbek16jow-3D-3D

_______________________________________________
coreboot mailing list -- coreboot@coreboot.org
To unsubscribe send an email to coreboot-le...@coreboot.org

Reply via email to