[coreboot] New Defects reported by Coverity Scan for coreboot

scan-admin at coverity.com scan-admin at coverity.com
Mon Jul 11 22:39:47 CEST 2016


Hi,

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

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


** CID 1357464:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 71 in platform_i2c_transfer()


________________________________________________________________________________________________________
*** CID 1357464:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 71 in platform_i2c_transfer()
65     	/* Set the slave address */
66     	ASSERT (count > 0);
67     	ASSERT (segments != NULL);
68     	ASSERT (segments->read == 0);
69     
70     	/* Clear the start and stop detection */
>>>     CID 1357464:  Incorrect expression  (UNUSED_VALUE)
>>>     Assigning value from "regs->ic_clr_start_det" to "status" here, but that stored value is overwritten before it can be used.
71     	status = regs->ic_clr_start_det;
72     	status = regs->ic_clr_stop_det;
73     
74     	/* Set addressing mode to 7-bit and fast mode */
75     	cmd = regs->ic_con;
76     	cmd &= ~(IC_CON_10B | IC_CON_SPEED);

** CID 1357463:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 91 in platform_i2c_transfer()


________________________________________________________________________________________________________
*** CID 1357463:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 91 in platform_i2c_transfer()
85     	/* Enable the I2C controller */
86     	regs->ic_enable = IC_ENABLE_CONTROLLER;
87     
88     	/* Clear the interrupts */
89     	status = regs->ic_clr_rx_under;
90     	status = regs->ic_clr_rx_over;
>>>     CID 1357463:  Incorrect expression  (UNUSED_VALUE)
>>>     Assigning value from "regs->ic_clr_tx_over" to "status" here, but that stored value is overwritten before it can be used.
91     	status = regs->ic_clr_tx_over;
92     	status = regs->ic_clr_tx_abrt;
93     
94     	/* Process each of the segments */
95     	bytes_transferred = 0;
96     	read_length = 0;

** CID 1357462:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 90 in platform_i2c_transfer()


________________________________________________________________________________________________________
*** CID 1357462:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 90 in platform_i2c_transfer()
84     
85     	/* Enable the I2C controller */
86     	regs->ic_enable = IC_ENABLE_CONTROLLER;
87     
88     	/* Clear the interrupts */
89     	status = regs->ic_clr_rx_under;
>>>     CID 1357462:  Incorrect expression  (UNUSED_VALUE)
>>>     Assigning value from "regs->ic_clr_rx_over" to "status" here, but that stored value is overwritten before it can be used.
90     	status = regs->ic_clr_rx_over;
91     	status = regs->ic_clr_tx_over;
92     	status = regs->ic_clr_tx_abrt;
93     
94     	/* Process each of the segments */
95     	bytes_transferred = 0;

** CID 1357461:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 89 in platform_i2c_transfer()


________________________________________________________________________________________________________
*** CID 1357461:  Incorrect expression  (UNUSED_VALUE)
/src/soc/intel/quark/i2c.c: 89 in platform_i2c_transfer()
83     	regs->ic_tar = chip;
84     
85     	/* Enable the I2C controller */
86     	regs->ic_enable = IC_ENABLE_CONTROLLER;
87     
88     	/* Clear the interrupts */
>>>     CID 1357461:  Incorrect expression  (UNUSED_VALUE)
>>>     Assigning value from "regs->ic_clr_rx_under" to "status" here, but that stored value is overwritten before it can be used.
89     	status = regs->ic_clr_rx_under;
90     	status = regs->ic_clr_rx_over;
91     	status = regs->ic_clr_tx_over;
92     	status = regs->ic_clr_tx_abrt;
93     
94     	/* Process each of the segments */

** CID 1357460:  Code maintainability issues  (UNUSED_VALUE)
/src/soc/intel/quark/reg_access.c: 230 in reg_read()


________________________________________________________________________________________________________
*** CID 1357460:  Code maintainability issues  (UNUSED_VALUE)
/src/soc/intel/quark/reg_access.c: 230 in reg_read()
224     		ctx->display_prefix = "GPIO";
225     		value = reg_gpio_read(step->reg);
226     		break;
227     
228     	case LEG_GPIO_REGS:
229     		ctx->display_prefix = "Legacy GPIO";
>>>     CID 1357460:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "reg_legacy_gpio_read(step->reg)" to "value" here, but that stored value is overwritten before it can be used.
230     		value = reg_legacy_gpio_read(step->reg);
231     
232     	case PCIE_AFE_REGS:
233     		ctx->display_prefix = "PCIe AFE";
234     		value = reg_pcie_afe_read(step->reg);
235     		break;

** CID 1357459:  Uninitialized variables  (UNINIT)
/src/mainboard/google/gru/mainboard.c: 173 in setup_rtc()


________________________________________________________________________________________________________
*** CID 1357459:  Uninitialized variables  (UNINIT)
/src/mainboard/google/gru/mainboard.c: 173 in setup_rtc()
167     	setup_usb_drd0_dwc3();
168     	setup_usb_drd1_dwc3();
169     }
170     
171     static void setup_rtc(void)
172     {
>>>     CID 1357459:  Uninitialized variables  (UNINIT)
>>>     Declaring variable "time" without initializer.
173     	struct rtc_time time;
174     	int ret;
175     
176     	/* Show the current time to see that the EC RTC is working */
177     	google_chromeec_init();
178     	ret = rtc_get(&time);

** CID 1357458:  Insecure data handling  (TAINTED_SCALAR)
/payloads/libpayload/libcbfs/cbfs_core.c: 255 in cbfs_get_contents()


________________________________________________________________________________________________________
*** CID 1357458:  Insecure data handling  (TAINTED_SCALAR)
/payloads/libpayload/libcbfs/cbfs_core.c: 255 in cbfs_get_contents()
249     
250     	void *data = m->map(m, handle->media_offset + handle->content_offset,
251     			    on_media_size);
252     	if (data == CBFS_MEDIA_INVALID_MAP_ADDRESS)
253     		return NULL;
254     
>>>     CID 1357458:  Insecure data handling  (TAINTED_SCALAR)
>>>     Passing tainted variable "*size" to a tainted sink. [Note: The source code implementation of the function has been overridden by a builtin model.]
255     	ret = malloc(*size);
256     	if (ret != NULL && !cbfs_decompress(algo, data, ret, *size)) {
257     		free(ret);
258     		ret = NULL;
259     	}
260     

** CID 1357457:  Resource leaks  (RESOURCE_LEAK)
/src/arch/x86/acpi_device.c: 737 in acpi_dp_add_integer_array()


________________________________________________________________________________________________________
*** CID 1357457:  Resource leaks  (RESOURCE_LEAK)
/src/arch/x86/acpi_device.c: 737 in acpi_dp_add_integer_array()
731     		return NULL;
732     
733     	for (i = 0; i < len; i++)
734     		if (!acpi_dp_add_integer(dp_array, NULL, array[i]))
735     			break;
736     
>>>     CID 1357457:  Resource leaks  (RESOURCE_LEAK)
>>>     Ignoring storage allocated by "acpi_dp_add_array(dp, dp_array)" leaks it.
737     	acpi_dp_add_array(dp, dp_array);
738     
739     	return dp_array;
740     }
741     
742     struct acpi_dp *acpi_dp_add_gpio(struct acpi_dp *dp, const char *name,

** CID 1357456:  Resource leaks  (RESOURCE_LEAK)
/src/arch/x86/acpi_device.c: 763 in acpi_dp_add_gpio()


________________________________________________________________________________________________________
*** CID 1357456:  Resource leaks  (RESOURCE_LEAK)
/src/arch/x86/acpi_device.c: 763 in acpi_dp_add_gpio()
757     	/* Pin in the GPIO resource, typically zero */
758     	acpi_dp_add_integer(gpio, NULL, pin);
759     
760     	/* Set if pin is active low */
761     	acpi_dp_add_integer(gpio, NULL, active_low);
762     
>>>     CID 1357456:  Resource leaks  (RESOURCE_LEAK)
>>>     Ignoring storage allocated by "acpi_dp_add_array(dp, gpio)" leaks it.
763     	acpi_dp_add_array(dp, gpio);
764     
765     	return gpio;

** CID 1357455:    (RESOURCE_LEAK)
/payloads/libpayload/libcbfs/cbfs_core.c: 218 in cbfs_get_handle()
/payloads/libpayload/libcbfs/cbfs_core.c: 151 in cbfs_get_handle()
/payloads/libpayload/libcbfs/cbfs_core.c: 158 in cbfs_get_handle()


________________________________________________________________________________________________________
*** CID 1357455:    (RESOURCE_LEAK)
/payloads/libpayload/libcbfs/cbfs_core.c: 218 in cbfs_get_handle()
212     		offset += ntohl(file.len) + ntohl(file.offset);
213     		if (offset % CBFS_ALIGNMENT)
214     			offset += CBFS_ALIGNMENT - (offset % CBFS_ALIGNMENT);
215     	}
216     	media->close(media);
217     	LOG("WARNING: '%s' not found.\n", name);
>>>     CID 1357455:    (RESOURCE_LEAK)
>>>     Variable "handle" going out of scope leaks the storage it points to.
218     	return NULL;
219     }
220     
221     void *cbfs_get_contents(struct cbfs_handle *handle, size_t *size, size_t limit)
222     {
223     	struct cbfs_media *m = &handle->media;
/payloads/libpayload/libcbfs/cbfs_core.c: 151 in cbfs_get_handle()
145     
146     	if (!handle)
147     		return NULL;
148     
149     	if (get_cbfs_range(&offset, &cbfs_end, media)) {
150     		ERROR("Failed to find cbfs range\n");
>>>     CID 1357455:    (RESOURCE_LEAK)
>>>     Variable "handle" going out of scope leaks the storage it points to.
151     		return NULL;
152     	}
153     
154     	if (media == CBFS_DEFAULT_MEDIA) {
155     		media = &handle->media;
156     		if (init_default_cbfs_media(media) != 0) {
/payloads/libpayload/libcbfs/cbfs_core.c: 158 in cbfs_get_handle()
152     	}
153     
154     	if (media == CBFS_DEFAULT_MEDIA) {
155     		media = &handle->media;
156     		if (init_default_cbfs_media(media) != 0) {
157     			ERROR("Failed to initialize default media.\n");
>>>     CID 1357455:    (RESOURCE_LEAK)
>>>     Returning without freeing "media" leaks the storage that it points to.
158     			return NULL;
159     		}
160     	} else {
161     		memcpy(&handle->media, media, sizeof(*media));
162     	}
163     

** CID 1357454:  Memory - illegal accesses  (OVERRUN)
/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/LN/mnln.c: 255 in MemConstructNBBlockLN()


________________________________________________________________________________________________________
*** CID 1357454:  Memory - illegal accesses  (OVERRUN)
/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/LN/mnln.c: 255 in MemConstructNBBlockLN()
249       NBPtr->BeforeDqsTraining = MemNBeforeDQSTrainingLN;
250       NBPtr->AfterDqsTraining = MemNAfterDQSTrainingLN;
251       NBPtr->OtherTiming = MemNOtherTimingLN;
252       NBPtr->GetSocketRelativeChannel = MemNGetSocketRelativeChannelNb;
253       NBPtr->TechBlockSwitch = MemNTechBlockSwitchLN;
254       NBPtr->SetEccSymbolSize = (VOID (*) (MEM_NB_BLOCK *)) memDefRet;
>>>     CID 1357454:  Memory - illegal accesses  (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
255       NBPtr->TrainingFlow = (VOID (*) (MEM_NB_BLOCK *))(memNTrainFlowControl[DDR3_TRAIN_FLOW]);
256       NBPtr->MinDataEyeWidth = MemNMinDataEyeWidthNb;
257       NBPtr->ChangeNbFrequencyWrap = MemNChangeNbFrequencyWrapLN;
258       NBPtr->AllocateC6Storage = MemNAllocateC6StorageClientNb;
259     
260       MemNInitNBDataNb (NBPtr);

** CID 1357453:  Memory - illegal accesses  (OVERRUN)
/src/vendorcode/amd/agesa/f14/Proc/Mem/NB/ON/mnon.c: 254 in MemConstructNBBlockON()


________________________________________________________________________________________________________
*** CID 1357453:  Memory - illegal accesses  (OVERRUN)
/src/vendorcode/amd/agesa/f14/Proc/Mem/NB/ON/mnon.c: 254 in MemConstructNBBlockON()
248       NBPtr->BeforeDqsTraining = MemNBeforeDQSTrainingON;
249       NBPtr->AfterDqsTraining = MemNAfterDQSTrainingON;
250       NBPtr->OtherTiming = MemNOtherTimingON;
251       NBPtr->GetSocketRelativeChannel = MemNGetSocketRelativeChannelNb;
252       NBPtr->TechBlockSwitch = MemNTechBlockSwitchON;
253       NBPtr->SetEccSymbolSize = (VOID (*) (MEM_NB_BLOCK *)) memDefRet;
>>>     CID 1357453:  Memory - illegal accesses  (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
254       NBPtr->TrainingFlow = (VOID (*) (MEM_NB_BLOCK *)) memNTrainFlowControl[DDR3_TRAIN_FLOW];
255       NBPtr->MinDataEyeWidth = MemNMinDataEyeWidthNb;
256       NBPtr->PollBitField = MemNPollBitFieldNb;
257       NBPtr->BrdcstCheck = MemNBrdcstCheckON;
258       NBPtr->BrdcstSet = MemNSetBitFieldNb;
259       NBPtr->GetTrainDly = MemNGetTrainDlyNb;

** CID 1357452:    (OVERRUN)
/src/vendorcode/amd/agesa/f15/Proc/Mem/NB/mn.c: 502 in MemNTrainingFlowUnb()
/src/vendorcode/amd/agesa/f14/Proc/Mem/NB/mn.c: 499 in MemNTrainingFlowUnb()
/src/vendorcode/amd/agesa/f16kb/Proc/Mem/NB/mn.c: 579 in MemNTrainingFlowUnb()
/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mn.c: 497 in MemNTrainingFlowUnb()
/src/vendorcode/amd/agesa/f15tn/Proc/Mem/NB/mn.c: 495 in MemNTrainingFlowUnb()


________________________________________________________________________________________________________
*** CID 1357452:    (OVERRUN)
/src/vendorcode/amd/agesa/f15/Proc/Mem/NB/mn.c: 502 in MemNTrainingFlowUnb()
496      */
497     BOOLEAN
498     MemNTrainingFlowUnb (
499       IN OUT   MEM_NB_BLOCK *NBPtr
500       )
501     {
>>>     CID 1357452:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
502       memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
503       return TRUE;
504     }
505     /*----------------------------------------------------------------------------
506      *                              LOCAL FUNCTIONS
507      *
/src/vendorcode/amd/agesa/f14/Proc/Mem/NB/mn.c: 499 in MemNTrainingFlowUnb()
493      */
494     BOOLEAN
495     MemNTrainingFlowUnb (
496       IN OUT   MEM_NB_BLOCK *NBPtr
497       )
498     {
>>>     CID 1357452:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
499       memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
500       return TRUE;
501     }
502     /*----------------------------------------------------------------------------
503      *                              LOCAL FUNCTIONS
504      *
/src/vendorcode/amd/agesa/f16kb/Proc/Mem/NB/mn.c: 579 in MemNTrainingFlowUnb()
573      */
574     BOOLEAN
575     MemNTrainingFlowUnb (
576       IN OUT   MEM_NB_BLOCK *NBPtr
577       )
578     {
>>>     CID 1357452:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
579       memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
580       return TRUE;
581     }
582     
583     /* -----------------------------------------------------------------------------*/
584     /**
/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mn.c: 497 in MemNTrainingFlowUnb()
491      */
492     BOOLEAN
493     MemNTrainingFlowUnb (
494       IN OUT   MEM_NB_BLOCK *NBPtr
495       )
496     {
>>>     CID 1357452:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
497       memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
498       return TRUE;
499     }
500     /*----------------------------------------------------------------------------
501      *                              LOCAL FUNCTIONS
502      *
/src/vendorcode/amd/agesa/f15tn/Proc/Mem/NB/mn.c: 495 in MemNTrainingFlowUnb()
489      */
490     VOID
491     MemNTrainingFlowUnb (
492       IN OUT   MEM_NB_BLOCK *NBPtr
493       )
494     {
>>>     CID 1357452:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
495       memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
496       return;
497     }
498     /*----------------------------------------------------------------------------
499      *                              LOCAL FUNCTIONS
500      *
501      *----------------------------------------------------------------------------

** CID 1357451:    (OVERRUN)
/src/vendorcode/amd/agesa/f15/Proc/Mem/NB/mn.c: 309 in MemNTrainingFlowNb()
/src/vendorcode/amd/agesa/f14/Proc/Mem/NB/mn.c: 306 in MemNTrainingFlowNb()
/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mn.c: 304 in MemNTrainingFlowNb()
/src/vendorcode/amd/agesa/f15tn/Proc/Mem/NB/mn.c: 302 in MemNTrainingFlowNb()


________________________________________________________________________________________________________
*** CID 1357451:    (OVERRUN)
/src/vendorcode/amd/agesa/f15/Proc/Mem/NB/mn.c: 309 in MemNTrainingFlowNb()
303     BOOLEAN
304     MemNTrainingFlowNb (
305       IN OUT   MEM_NB_BLOCK *NBPtr
306       )
307     {
308       if (MemNGetBitFieldNb (NBPtr, BFDdr3Mode)!= 0) {
>>>     CID 1357451:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
309         memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
310       } else {
311         memNTrainFlowControl[DDR2_TRAIN_FLOW] (NBPtr);
312       }
313       return TRUE;
314     }
/src/vendorcode/amd/agesa/f14/Proc/Mem/NB/mn.c: 306 in MemNTrainingFlowNb()
300     BOOLEAN
301     MemNTrainingFlowNb (
302       IN OUT   MEM_NB_BLOCK *NBPtr
303       )
304     {
305       if (MemNGetBitFieldNb (NBPtr, BFDdr3Mode)!= 0) {
>>>     CID 1357451:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
306         memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
307       } else {
308         memNTrainFlowControl[DDR2_TRAIN_FLOW] (NBPtr);
309       }
310       return TRUE;
311     }
/src/vendorcode/amd/agesa/f12/Proc/Mem/NB/mn.c: 304 in MemNTrainingFlowNb()
298     BOOLEAN
299     MemNTrainingFlowNb (
300       IN OUT   MEM_NB_BLOCK *NBPtr
301       )
302     {
303       if (MemNGetBitFieldNb (NBPtr, BFDdr3Mode)!= 0) {
>>>     CID 1357451:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
304         memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
305       } else {
306         memNTrainFlowControl[DDR2_TRAIN_FLOW] (NBPtr);
307       }
308       return TRUE;
309     }
/src/vendorcode/amd/agesa/f15tn/Proc/Mem/NB/mn.c: 302 in MemNTrainingFlowNb()
296     BOOLEAN
297     MemNTrainingFlowNb (
298       IN OUT   MEM_NB_BLOCK *NBPtr
299       )
300     {
301       if (MemNGetBitFieldNb (NBPtr, BFDdr3Mode)!= 0) {
>>>     CID 1357451:    (OVERRUN)
>>>     Overrunning array "memNTrainFlowControl" of 1 4-byte elements at element index 1 (byte offset 4) using index "1".
302         memNTrainFlowControl[DDR3_TRAIN_FLOW] (NBPtr);
303       } else {
304         memNTrainFlowControl[DDR2_TRAIN_FLOW] (NBPtr);
305       }
306       return TRUE;
307     }

** CID 1357450:    (NO_EFFECT)
/src/soc/intel/skylake/romstage/i2c.c: 59 in i2c_early_init_bus()
/src/soc/intel/apollolake/i2c_early.c: 42 in i2c_early_init_bus()


________________________________________________________________________________________________________
*** CID 1357450:    (NO_EFFECT)
/src/soc/intel/skylake/romstage/i2c.c: 59 in i2c_early_init_bus()
53     	uintptr_t base;
54     	uint32_t value;
55     	void *reg;
56     
57     	/* Find the PCI device for this bus controller */
58     	devfn = i2c_bus_to_devfn(bus);
>>>     CID 1357450:    (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "devfn < 0U".
59     	if (devfn < 0)
60     		return;
61     
62     	/* Look up the controller device in the devicetree */
63     	dev = PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn));
64     	tree_dev = dev_find_slot(0, devfn);
/src/soc/intel/apollolake/i2c_early.c: 42 in i2c_early_init_bus()
36     	uintptr_t base;
37     	uint32_t value;
38     	void *reg;
39     
40     	/* Find the PCI device for this bus controller */
41     	devfn = i2c_bus_to_devfn(bus);
>>>     CID 1357450:    (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "devfn < 0U".
42     	if (devfn < 0) {
43     		printk(BIOS_ERR, "I2C%u device not found\n", bus);
44     		return -1;
45     	}
46     
47     	/* Look up the controller device in the devicetree */

** CID 1357449:    (NO_EFFECT)
/src/soc/intel/apollolake/i2c.c: 37 in lpss_i2c_base_address()
/src/soc/intel/skylake/i2c.c: 33 in lpss_i2c_base_address()
/src/soc/intel/skylake/romstage/i2c.c: 35 in lpss_i2c_base_address()
/src/soc/intel/apollolake/i2c_early.c: 101 in lpss_i2c_base_address()


________________________________________________________________________________________________________
*** CID 1357449:    (NO_EFFECT)
/src/soc/intel/apollolake/i2c.c: 37 in lpss_i2c_base_address()
31     	unsigned devfn;
32     	struct device *dev;
33     	struct resource *res;
34     
35     	/* bus -> devfn */
36     	devfn = i2c_bus_to_devfn(bus);
>>>     CID 1357449:    (NO_EFFECT)
>>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "devfn >= 0U".
37     	if (devfn >= 0) {
38     		/* devfn -> dev */
39     		dev = dev_find_slot(0, devfn);
40     		if (dev) {
41     			/* dev -> bar0 */
42     			res = find_resource(dev, PCI_BASE_ADDRESS_0);
/src/soc/intel/skylake/i2c.c: 33 in lpss_i2c_base_address()
27     	unsigned devfn;
28     	struct device *dev;
29     	struct resource *res;
30     
31     	/* bus -> devfn */
32     	devfn = i2c_bus_to_devfn(bus);
>>>     CID 1357449:    (NO_EFFECT)
>>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "devfn >= 0U".
33     	if (devfn >= 0) {
34     		/* devfn -> dev */
35     		dev = dev_find_slot(0, devfn);
36     		if (dev) {
37     			/* dev -> bar0 */
38     			res = find_resource(dev, PCI_BASE_ADDRESS_0);
/src/soc/intel/skylake/romstage/i2c.c: 35 in lpss_i2c_base_address()
29     {
30     	unsigned devfn;
31     	pci_devfn_t dev;
32     
33     	/* Find device+function for this controller */
34     	devfn = i2c_bus_to_devfn(bus);
>>>     CID 1357449:    (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "devfn < 0U".
35     	if (devfn < 0)
36     		return 0;
37     
38     	/* Form a PCI address for this device */
39     	dev = PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn));
40     
/src/soc/intel/apollolake/i2c_early.c: 101 in lpss_i2c_base_address()
95     	unsigned devfn;
96     	pci_devfn_t dev;
97     	uintptr_t base;
98     
99     	/* Find device+function for this controller */
100     	devfn = i2c_bus_to_devfn(bus);
>>>     CID 1357449:    (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true. "devfn < 0U".
101     	if (devfn < 0)
102     		return (uintptr_t)NULL;
103     
104     	/* Form a PCI address for this device */
105     	dev = PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn));
106     

** CID 1357448:  Control flow issues  (NO_EFFECT)
/src/soc/intel/apollolake/include/soc/i2c.h: 31 in i2c_bus_to_devfn()


________________________________________________________________________________________________________
*** CID 1357448:  Control flow issues  (NO_EFFECT)
/src/soc/intel/apollolake/include/soc/i2c.h: 31 in i2c_bus_to_devfn()
25     #define I2C_LPSS_RESET_RELEASE_HC	((1 << 1) | (1 << 0))
26     #define I2C_LPSS_RESET_RELEASE_IDMA	(1 << 2)
27     
28     /* Convert I2C bus number to PCI device and function */
29     static inline int i2c_bus_to_devfn(unsigned bus)
30     {
>>>     CID 1357448:  Control flow issues  (NO_EFFECT)
>>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "bus >= 0U".
31     	if (bus >= 0 && bus <= 3)
32     		return PCI_DEVFN(LPSS_DEV_SLOT_I2C_D0, bus);
33     	else if (bus >= 4 && bus <= 7)
34     		return PCI_DEVFN(LPSS_DEV_SLOT_I2C_D1, (bus - 4));
35     	else
36     		return -1;

** CID 1357447:  Control flow issues  (MISSING_BREAK)
/src/soc/intel/quark/reg_access.c: 232 in reg_read()


________________________________________________________________________________________________________
*** CID 1357447:  Control flow issues  (MISSING_BREAK)
/src/soc/intel/quark/reg_access.c: 232 in reg_read()
226     		break;
227     
228     	case LEG_GPIO_REGS:
229     		ctx->display_prefix = "Legacy GPIO";
230     		value = reg_legacy_gpio_read(step->reg);
231     
>>>     CID 1357447:  Control flow issues  (MISSING_BREAK)
>>>     The above case falls through to this one.
232     	case PCIE_AFE_REGS:
233     		ctx->display_prefix = "PCIe AFE";
234     		value = reg_pcie_afe_read(step->reg);
235     		break;
236     
237     	case RMU_TEMP_REGS:

** CID 1357446:  Control flow issues  (DEADCODE)
/src/northbridge/intel/x4x/raminit.c: 424 in sdram_detect_ram_speed()


________________________________________________________________________________________________________
*** CID 1357446:  Control flow issues  (DEADCODE)
/src/northbridge/intel/x4x/raminit.c: 424 in sdram_detect_ram_speed()
418     	} else { // DDR3
419     		// Limit frequency for MCH
420     		maxfreq = (s->max_ddr2_mhz == 800) ? MEM_CLOCK_800MHz : MEM_CLOCK_667MHz;
421     		maxfreq >>= 3;
422     		freq = MEM_CLOCK_1333MHz;
423     		if (maxfreq) {
>>>     CID 1357446:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "freq = maxfreq + 2;".
424     			freq = maxfreq + 2;
425     		}
426     		if (freq > MEM_CLOCK_1333MHz) {
427     			freq = MEM_CLOCK_1333MHz;
428     		}
429     

** CID 1357445:  Control flow issues  (DEADCODE)
/src/soc/rockchip/rk3399/display.c: 108 in rk_display_init()


________________________________________________________________________________________________________
*** CID 1357445:  Control flow issues  (DEADCODE)
/src/soc/rockchip/rk3399/display.c: 108 in rk_display_init()
102     	edid.y_resolution = edid.mode.va;
103     	rkvop_mode_set(conf->vop_id, &edid, detected_mode);
104     
105     	rkvop_enable(conf->vop_id, lcdbase, &edid);
106     
107     	switch (detected_mode) {
>>>     CID 1357445:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "case VOP_MODE_HDMI:".
108     	case VOP_MODE_HDMI:
109     		/* should not be here before HDMI supported */
110     		return;
111     	case VOP_MODE_EDP:
112     	default:
113     		if (rk_edp_enable()) {


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/coreboot?tab=overview

To manage Coverity Scan email notifications for "coreboot at coreboot.org", click https://scan.coverity.com/subscriptions/edit?email=coreboot%40coreboot.org&token=49533df725f93b78361afb7b89ccde93




More information about the coreboot mailing list