Skip to contentSkip to conversation

New Defects reported by Coverity Scan for Das U-Boot

DISCUSSION Tom Rini 2 participants 3 messages Mar 9

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

Hey all,

Unfortunately for such a small set of changes (rc3 to rc4) a lot of new Coverity scan issues have popped up. Please let me know if these appear to be real issues or something that we can mark as intentional / false positive. Thanks!

---------- Forwarded message ---------
From: <[email protected]>
Date: Mon, Mar 9, 2026, 2:11 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.

- *New Defects Found:* 4
- *Defects Shown:* Showing 4 of 4 defect(s)

Defect Details

** CID 644836: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 497 in stm32_dsi_probe()

_____________________________________________________________________________________________
*** CID 644836: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 497 in stm32_dsi_probe()

491     	priv->hw_version = dsi_read(plat->base, DSI_VERSION) & VERSION;
492     	if (priv->hw_version != HWVER_130 &&
493     	    priv->hw_version != HWVER_131) {
494     		dev_err(dev, "DSI version 0x%x not supported\n", priv->hw_version);
495     		dev_dbg(dev, "remove and unbind all DSI child\n");
496     		device_chld_remove(dev, NULL, DM_REMOVE_NORMAL);
>>>     CID 644836:         Error handling issues  (CHECKED_RETURN)
>>>     Calling "device_chld_unbind" without checking return value (as is done elsewhere 6 out of 7 times).
497     		device_chld_unbind(dev, NULL);
498     		ret = -ENODEV;
499     		goto err_clk;
500     	}

501
502 return 0;

** CID 644835: (TAINTED_SCALAR)
/common/menu.c: 589 in bootmenu_loop()
/common/menu.c: 589 in bootmenu_loop()

_____________________________________________________________________________________________
*** CID 644835: (TAINTED_SCALAR)
/common/menu.c: 589 in bootmenu_loop()

583     			c = cli_ch_process(cch, c);
584     		}
585     	}

586
587 key = bootmenu_conv_key(c);
588

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644835: (TAINTED_SCALAR)
Using tainted variable "(int)(unsigned char)c" as an index into an array "_ctype".

589     	if (key == BKEY_NONE && isalnum(c)) {
590     		key = BKEY_SHORTCUT;
591     		cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c);
592     	}
593
594     	return key;
/common/menu.c: 589             in bootmenu_loop()
583     			c = cli_ch_process(cch, c);
584     		}
585     	}

586
587 key = bootmenu_conv_key(c);
588

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644835: (TAINTED_SCALAR)
Using tainted variable "(int)(unsigned char)c" as an index into an array "_ctype".

589     	if (key == BKEY_NONE && isalnum(c)) {
590     		key = BKEY_SHORTCUT;
591     		cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c);
592     	}

593
594 return key;

** CID 644834: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 496 in stm32_dsi_probe()

_____________________________________________________________________________________________
*** CID 644834: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 496 in stm32_dsi_probe()

490     	/* check hardware version */
491     	priv->hw_version = dsi_read(plat->base, DSI_VERSION) & VERSION;
492     	if (priv->hw_version != HWVER_130 &&
493     	    priv->hw_version != HWVER_131) {
494     		dev_err(dev, "DSI version 0x%x not supported\n", priv->hw_version);
495     		dev_dbg(dev, "remove and unbind all DSI child\n");
>>>     CID 644834:         Error handling issues  (CHECKED_RETURN)
>>>     Calling "device_chld_remove" without checking return value (as is done elsewhere 4 out of 5 times).
496     		device_chld_remove(dev, NULL, DM_REMOVE_NORMAL);
497     		device_chld_unbind(dev, NULL);
498     		ret = -ENODEV;
499     		goto err_clk;
500     	}

501

** CID 644833: Memory - illegal accesses (NEGATIVE_RETURNS)
/common/menu.c: 589 in bootmenu_loop()

_____________________________________________________________________________________________
*** CID 644833: Memory - illegal accesses (NEGATIVE_RETURNS)
/common/menu.c: 589 in bootmenu_loop()

583     			c = cli_ch_process(cch, c);
584     		}
585     	}

586
587 key = bootmenu_conv_key(c);
588

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644833: Memory - illegal accesses (NEGATIVE_RETURNS)
Using variable "c" as an index to array "_ctype".

589     	if (key == BKEY_NONE && isalnum(c)) {
590     		key = BKEY_SHORTCUT;
591     		cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c);
592     	}

593
594 return key;

View Defects in Coverity Scan
<https://scan.coverity.com/projects/das-u-boot?tab=overview>

Best regards,

The Coverity Scan Admin Team

----- End forwarded message -----

Signature · 1 line
Tom
#1 lore raw

Hi Tom,

Regarding both stm32_dsi errors:

It seems those errors are not linked to the patch you merged recently, because it does not change the lines mentioned by Coverity.

Calls to device_chld_{remove, unbind} are introduced by commit a6d047c0a86b ("video: stm32: remove all child of DSI bridge when its probe failed").

My guess is that since my patch changed the file, it triggered the Coverity Scan for the whole file.

Regardless, ret is overwritten right after the calls, so I don't think checking the return value matters here except if there is a log information.

Tell me if you want me to provide a fix, but in this case I'm not sure to see the point.

Best regards,
Raphaël

Quoted 140 lines · Tom Rini

Hey all,

Unfortunately for such a small set of changes (rc3 to rc4) a lot of new Coverity scan issues have popped up. Please let me know if these appear to be real issues or something that we can mark as intentional / false positive. Thanks!

---------- Forwarded message ---------
From: <[email protected]>
Date: Mon, Mar 9, 2026, 2:11 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.

- *New Defects Found:* 4
- *Defects Shown:* Showing 4 of 4 defect(s)

Defect Details

** CID 644836: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 497 in stm32_dsi_probe()

_____________________________________________________________________________________________
*** CID 644836: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 497 in stm32_dsi_probe()

491     	priv->hw_version = dsi_read(plat->base, DSI_VERSION) & VERSION;
492     	if (priv->hw_version != HWVER_130 &&
493     	    priv->hw_version != HWVER_131) {
494     		dev_err(dev, "DSI version 0x%x not supported\n", priv->hw_version);
495     		dev_dbg(dev, "remove and unbind all DSI child\n");
496     		device_chld_remove(dev, NULL, DM_REMOVE_NORMAL);
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644836: Error handling issues (CHECKED_RETURN)
Calling "device_chld_unbind" without checking return value (as is done elsewhere 6 out of 7 times).

497     		device_chld_unbind(dev, NULL);
498     		ret = -ENODEV;
499     		goto err_clk;
500     	}

501
502 return 0;

** CID 644835: (TAINTED_SCALAR)
/common/menu.c: 589 in bootmenu_loop()
/common/menu.c: 589 in bootmenu_loop()

_____________________________________________________________________________________________
*** CID 644835: (TAINTED_SCALAR)
/common/menu.c: 589 in bootmenu_loop()

583     			c = cli_ch_process(cch, c);
584     		}
585     	}

586
587 key = bootmenu_conv_key(c);
588

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644835: (TAINTED_SCALAR)
Using tainted variable "(int)(unsigned char)c" as an index into an array "_ctype".

589     	if (key == BKEY_NONE && isalnum(c)) {
590     		key = BKEY_SHORTCUT;
591     		cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c);
592     	}
593
594     	return key;
/common/menu.c: 589             in bootmenu_loop()
583     			c = cli_ch_process(cch, c);
584     		}
585     	}

586
587 key = bootmenu_conv_key(c);
588

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644835: (TAINTED_SCALAR)
Using tainted variable "(int)(unsigned char)c" as an index into an array "_ctype".

589     	if (key == BKEY_NONE && isalnum(c)) {
590     		key = BKEY_SHORTCUT;
591     		cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c);
592     	}

593
594 return key;

** CID 644834: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 496 in stm32_dsi_probe()

_____________________________________________________________________________________________
*** CID 644834: Error handling issues (CHECKED_RETURN)
/drivers/video/stm32/stm32_dsi.c: 496 in stm32_dsi_probe()

490     	/* check hardware version */
491     	priv->hw_version = dsi_read(plat->base, DSI_VERSION) & VERSION;
492     	if (priv->hw_version != HWVER_130 &&
493     	    priv->hw_version != HWVER_131) {
494     		dev_err(dev, "DSI version 0x%x not supported\n", priv->hw_version);
495     		dev_dbg(dev, "remove and unbind all DSI child\n");
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644834: Error handling issues (CHECKED_RETURN)
Calling "device_chld_remove" without checking return value (as is done elsewhere 4 out of 5 times).

496     		device_chld_remove(dev, NULL, DM_REMOVE_NORMAL);
497     		device_chld_unbind(dev, NULL);
498     		ret = -ENODEV;
499     		goto err_clk;
500     	}

501

** CID 644833: Memory - illegal accesses (NEGATIVE_RETURNS)
/common/menu.c: 589 in bootmenu_loop()

_____________________________________________________________________________________________
*** CID 644833: Memory - illegal accesses (NEGATIVE_RETURNS)
/common/menu.c: 589 in bootmenu_loop()

583     			c = cli_ch_process(cch, c);
584     		}
585     	}

586
587 key = bootmenu_conv_key(c);
588

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 644833: Memory - illegal accesses (NEGATIVE_RETURNS)
Using variable "c" as an index to array "_ctype".

589     	if (key == BKEY_NONE && isalnum(c)) {
590     		key = BKEY_SHORTCUT;
591     		cch->shortcut_key = bootmenu_conv_shortcut_key(menu, c);
592     	}

593
594 return key;

View Defects in Coverity Scan
<https://scan.coverity.com/projects/das-u-boot?tab=overview>

Best regards,

The Coverity Scan Admin Team

----- End forwarded message -----

author
#2 lore raw
Quoted 6 lines · Raphaël Gallais-Pou

Hi Tom,

Regarding both stm32_dsi errors:

It seems those errors are not linked to the patch you merged recently, because it does not change the lines mentioned by Coverity.

Ah, likely so, yes.

Quoted 11 lines

Calls to device_chld_{remove, unbind} are introduced by commit a6d047c0a86b ("video: stm32: remove all child of DSI bridge when its probe failed").

My guess is that since my patch changed the file, it triggered the Coverity Scan for the whole file.

Regardless, ret is overwritten right after the calls, so I don't think checking the return value matters here except if there is a log information.

Tell me if you want me to provide a fix, but in this case I'm not sure to see the point.

It would be good to match the usual pattern (drivers/scsi/scsi.c and drivers/ata/sata.c) even if it's an unlikey chain of events. Please send a patch, thanks!

Signature · 1 line
Tom