From: Simon Horman <horms@kernel.org>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Cc: Peter Korsgaard <peter@korsgaard.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: usb: dm9601: fix wrong return value in dm9601_mdio_read
Date: Tue, 27 Feb 2024 16:09:18 +0000 [thread overview]
Message-ID: <20240227160918.GB277116@kernel.org> (raw)
In-Reply-To: <20240225-dm9601_ret_err-v1-1-02c1d959ea59@gmail.com>
On Sun, Feb 25, 2024 at 12:20:06AM +0100, Javier Carrasco wrote:
> The MII code does not check the return value of mdio_read (among
> others), and therefore no error code should be sent. A previous fix to
> the use of an uninitialized variable propagates negative error codes,
> that might lead to wrong operations by the MII library.
>
> An example of such issues is the use of mii_nway_restart by the dm9601
> driver. The mii_nway_restart function does not check the value returned
> by mdio_read, which in this case might be a negative number which could
> contain the exact bit the function checks (BMCR_ANENABLE = 0x1000).
>
> Return zero in case of error, as it is common practice in users of
> mdio_read to avoid wrong uses of the return value.
>
> Fixes: 8f8abb863fa5 ("net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
I guess it would be nice if error values could be used,
but as you have described, that does not seem to be the case here.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2024-02-27 16:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-24 23:20 [PATCH] net: usb: dm9601: fix wrong return value in dm9601_mdio_read Javier Carrasco
2024-02-27 16:09 ` Simon Horman [this message]
2024-02-27 16:53 ` Peter Korsgaard
2024-02-28 2:17 ` Jakub Kicinski
2024-02-28 15:10 ` Andrew Lunn
2024-02-28 3:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240227160918.GB277116@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peter@korsgaard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.