Re: [PATCH net] net: phy: fix phy_read_poll_timeout argument type in genphy_loopback

From: Jakub Kicinski
Date: Thu Mar 14 2024 - 19:48:37 EST


On Thu, 14 Mar 2024 14:15:37 +0300 Nikita Kiryushin wrote:
> read_poll_timeout inside phy_read_poll_timeout can set val negative
> in some cases (for example, __mdiobus_read inside phy_read can return
> -EOPNOTSUPP).
>
> Supposedly, commit 4ec732951702 ("net: phylib: fix phy_read*_poll_timeout()")
> should fix problems with wrong-signed vals, but I do not see how
> as val is sent to phy_read as is and __val = phy_read (not val)
> is checked for sign.
>
> Change val type for signed to allow better error handling as done in other
> phy_read_poll_timeout callers. This will not fix any error handling
> by itself, but allows, for example, to modify cond with appropriate
> sign check or check resulting val separately.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 014068dcb5b1 ("net: phy: genphy_loopback: add link speed configuration")
> Signed-off-by: Nikita Kiryushin <kiryushin@xxxxxxxx>

Please use git send email, the patch is mangled.
--
pw-bot: cr