* re: can: flexcan: add mcf5441x support
@ 2021-08-03 15:23 Colin Ian King
2021-08-04 7:20 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2021-08-03 15:23 UTC (permalink / raw)
To: Angelo Dureghello
Cc: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
Jakub Kicinski, linux-can, netdev, linux-kernel
Hi,
Static analysis of linux-next with Coverity has detected a potential
issue with the following commit:
commit d9cead75b1c66b4660b4f87ff339234042d7c6a5
Author: Angelo Dureghello <angelo@kernel-space.org>
Date: Fri Jul 2 11:48:41 2021 +0200
can: flexcan: add mcf5441x support
The analysis is as follows:
650 static int flexcan_clks_enable(const struct flexcan_priv *priv)
651 {
1. var_decl: Declaring variable err without initializer.
652 int err;
653
2. Condition priv->clk_ipg, taking false branch.
654 if (priv->clk_ipg) {
655 err = clk_prepare_enable(priv->clk_ipg);
656 if (err)
657 return err;
658 }
659
3. Condition priv->clk_per, taking false branch.
660 if (priv->clk_per) {
661 err = clk_prepare_enable(priv->clk_per);
662 if (err)
663 clk_disable_unprepare(priv->clk_ipg);
664 }
665
Uninitialized scalar variable (UNINIT)
4. uninit_use: Using uninitialized value err.
666 return err;
667 }
I'm not sure if it's possible for priv->clk_ipg and priv_clk_per to both
be null, so I'm not sure if err can end up being not set. However, it
does seem that either err should be zero or some err value, but I was
unsure how err should be initialized in this corner case. As it stands,
err probably needs to be set just to be safe.
Colin
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: can: flexcan: add mcf5441x support
2021-08-03 15:23 can: flexcan: add mcf5441x support Colin Ian King
@ 2021-08-04 7:20 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2021-08-04 7:20 UTC (permalink / raw)
To: Colin Ian King
Cc: Angelo Dureghello, Wolfgang Grandegger, David S. Miller,
Jakub Kicinski, linux-can, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 890 bytes --]
On 03.08.2021 16:23:26, Colin Ian King wrote:
> I'm not sure if it's possible for priv->clk_ipg and priv_clk_per to both
> be null, so I'm not sure if err can end up being not set. However, it
> does seem that either err should be zero or some err value, but I was
> unsure how err should be initialized in this corner case. As it stands,
> err probably needs to be set just to be safe.
ACK - There was already a patch that fixes the problem, but I've not
included it in a pull request:
https://lore.kernel.org/linux-can/20210728075428.1493568-1-mkl@pengutronix.de/
Will send now one.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-04 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 15:23 can: flexcan: add mcf5441x support Colin Ian King
2021-08-04 7:20 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).