[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZfCOb4x/+41y+SW3@shell.armlinux.org.uk>
Date: Tue, 12 Mar 2024 17:18:39 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Daniil Dulov <d.dulov@...ddin.ru>
Cc: Jakub Kicinski <kuba@...nel.org>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Doug Berger <opendmb@...il.com>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH net-next] net: phy: mdio-bcm-unimac: Cast denominator to
unsigned long to avoid overflow
On Tue, Mar 12, 2024 at 07:53:58PM +0300, Daniil Dulov wrote:
> The expression priv->clk_freq * 2 can lead to overflow that will cause
> a division by zero. So, let's cast it to unsigned long to avoid it.
How does casting this help? "unsigned long" can still be 32-bit.
Maybe unimac_mdio_probe() should be validating the value it read from
DT won't overflow? I suspect that a value of 2.1GHz is way too large
for this property in any case.
https://en.wikipedia.org/wiki/Management_Data_Input/Output#Electrical_specification
(note, this driver is clause-22 only.)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists