Skip to contentSkip to conversation

New Defects reported by Coverity Scan for Das U-Boot

DISCUSSION Tom Rini 2 participants 3 messages Dec 31, 2024 – Jan 2, 2025

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

Hey all, here's the latest report.

---------- Forwarded message ---------
From: <[email protected]>
Date: Mon, Dec 30, 2024, 10:44 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.

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)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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 }

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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 -----

Signature · 1 line
Tom
#1 lore raw

Hi Tom,
These defects won't appear when SPI_STACKED_PARALLEL config is enabled. We can mark these as false positives.

Thanks
Venkatesh

Quoted 82 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Tuesday, December 31, 2024 7:25 PM
To: [email protected]; Abbarapu, Venkatesh <[email protected]>
Subject: Fwd: New Defects reported by Coverity Scan for Das U-Boot

Hey all, here's the latest report.

---------- Forwarded message ---------
From: <[email protected]>
Date: Mon, Dec 30, 2024, 10:44 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.

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)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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 }

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

author
#2 lore raw
Quoted 2 lines · Venkatesh

Hi Tom,
These defects won't appear when SPI_STACKED_PARALLEL config is enabled. We can mark these as false positives.

OK, thanks.

Signature · 1 line
Tom