Re: [PATCH v2] net/ethtool/ioctl: ensure that we have phy ops before using them
From: Jakub Kicinski
Date: Mon Nov 21 2022 - 23:29:56 EST
On Mon, 21 Nov 2022 17:05:56 +0300 Daniil Tatianin wrote:
> ops->get_ethtool_phy_stats was getting called in an else branch
> of ethtool_get_phy_stats() unconditionally without making sure
> it was actually present.
>
> Refactor the checks to avoid unnecessary nesting and make them more
> readable. Add an extra WARN_ON_ONCE(1) to emit a warning when a driver
> declares that it has phy stats without a way to retrieve them.
>
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
>
> Suggested-by: Jakub Kicinski <kuba@xxxxxxxxxx>
> Signed-off-by: Daniil Tatianin <d-tatianin@xxxxxxxxxxxxxx>
Didn't make it to the list again :S Maybe try stripping the To/CC to
just netdev@, Andrew Lunn and Michal Kubecek?