Fwd: New Defects reported by Coverity Scan for Das U-Boot

Hey all, here's the latest report.
---------- Forwarded message --------- From: scan-admin@coverity.com Date: Mon, Dec 30, 2024, 10:44 PM Subject: New Defects reported by Coverity Scan for Das U-Boot To: tom.rini@gmail.com
Hi,
Please find the latest report on new defect(s) introduced to Das U-Boot found with Coverity Scan.
2 new defect(s) introduced to Das U-Boot 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 2 of 2 defect(s)
** CID 528528: Control flow issues (DEADCODE) /drivers/mtd/spi/spi-nor-core.c: 1644 in spi_nor_read()
________________________________________________________________________________________________________ *** CID 528528: Control flow issues (DEADCODE) /drivers/mtd/spi/spi-nor-core.c: 1644 in spi_nor_read() 1638 read_len = len; 1639 else 1640 read_len = rem_bank_len; 1641 #endif 1642 1643 if (read_len == 0)
CID 528528: Control flow issues (DEADCODE) Execution cannot reach this statement: "return -5;".
1644 return -EIO; 1645 1646 ret = nor->read(nor, offset, read_len, buf); 1647 if (ret == 0) { 1648 /* We shouldn't see 0-length reads */ 1649 ret = -EIO;
** CID 528527: Code maintainability issues (UNUSED_VALUE) /drivers/mtd/spi/spi-nor-core.c: 1613 in spi_nor_read()
________________________________________________________________________________________________________ *** CID 528527: Code maintainability issues (UNUSED_VALUE) /drivers/mtd/spi/spi-nor-core.c: 1613 in spi_nor_read() 1607 } 1608 rem_bank_len = SZ_16M * (bank + 1); 1609 if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) { 1610 if (nor->flags & SNOR_F_HAS_PARALLEL) 1611 rem_bank_len *= 2; 1612 }
CID 528527: Code maintainability issues (UNUSED_VALUE) Assigning value from "rem_bank_len - from" to "rem_bank_len" here,
but that stored value is overwritten before it can be used. 1613 rem_bank_len -= from; 1614 } 1615 1616 if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) { 1617 if (nor->flags & SNOR_F_HAS_STACKED) { 1618 stack_shift = 1;
----- End forwarded message -----

Hi Tom, These defects won't appear when SPI_STACKED_PARALLEL config is enabled. We can mark these as false positives.
Thanks Venkatesh
-----Original Message----- From: Tom Rini trini@konsulko.com Sent: Tuesday, December 31, 2024 7:25 PM To: u-boot@lists.denx.de; Abbarapu, Venkatesh venkatesh.abbarapu@amd.com Subject: Fwd: New Defects reported by Coverity Scan for Das U-Boot
Hey all, here's the latest report.
---------- Forwarded message --------- From: scan-admin@coverity.com Date: Mon, Dec 30, 2024, 10:44 PM Subject: New Defects reported by Coverity Scan for Das U-Boot To: tom.rini@gmail.com
Hi,
Please find the latest report on new defect(s) introduced to Das U-Boot found with Coverity Scan.
2 new defect(s) introduced to Das U-Boot 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 2 of 2 defect(s)
** CID 528528: Control flow issues (DEADCODE) /drivers/mtd/spi/spi-nor-core.c: 1644 in spi_nor_read()
*** CID 528528: Control flow issues (DEADCODE) /drivers/mtd/spi/spi-nor-core.c: 1644 in spi_nor_read() 1638 read_len = len; 1639 else 1640 read_len = rem_bank_len; 1641 #endif 1642 1643 if (read_len == 0)
CID 528528: Control flow issues (DEADCODE) Execution cannot reach this statement: "return -5;".
1644 return -EIO; 1645 1646 ret = nor->read(nor, offset, read_len, buf); 1647 if (ret == 0) { 1648 /* We shouldn't see 0-length reads */ 1649 ret = -EIO;
** CID 528527: Code maintainability issues (UNUSED_VALUE) /drivers/mtd/spi/spi-nor-core.c: 1613 in spi_nor_read()
*** CID 528527: Code maintainability issues (UNUSED_VALUE) /drivers/mtd/spi/spi-nor-core.c: 1613 in spi_nor_read() 1607 } 1608 rem_bank_len = SZ_16M * (bank + 1); 1609 if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) { 1610 if (nor->flags & SNOR_F_HAS_PARALLEL) 1611 rem_bank_len *= 2; 1612 }
CID 528527: Code maintainability issues (UNUSED_VALUE) Assigning value from "rem_bank_len - from" to "rem_bank_len"
here,
but that stored value is overwritten before it can be used. 1613 rem_bank_len -= from; 1614 } 1615 1616 if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) { 1617 if (nor->flags & SNOR_F_HAS_STACKED) { 1618 stack_shift = 1;
----- End forwarded message -----
-- Tom

On Wed, Jan 01, 2025 at 10:50:02AM +0000, Abbarapu, Venkatesh wrote:
Hi Tom, These defects won't appear when SPI_STACKED_PARALLEL config is enabled. We can mark these as false positives.
OK, thanks.
participants (2)
-
Abbarapu, Venkatesh
-
Tom Rini