Re: [PATCH] net: phy: mdio-bcm-unimac: Cast denominator to unsigned long to avoid overflow

From: Florian Fainelli
Date: Thu Mar 07 2024 - 15:21:44 EST




On 3/7/2024 5:19 AM, 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.

It will not in real life because the maximum clock frequency is 250MHz, but it also does not hurt.


Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: b78ac6ecd1b6 ("net: phy: mdio-bcm-unimac: Allow configuring MDIO clock divider")
Signed-off-by: Daniil Dulov <d.dulov@xxxxxxxxxx>

Acked-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
--
Florian

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature