public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Cc: "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 17:53:22 +0100	[thread overview]
Message-ID: <874jdtsvb1.fsf@48ers.dk> (raw)
In-Reply-To: <20240225-dm9601_ret_err-v1-1-02c1d959ea59@gmail.com> (Javier Carrasco's message of "Sun, 25 Feb 2024 00:20:06 +0100")

>>>>> "Javier" == Javier Carrasco <javier.carrasco.cruz@gmail.com> writes:

 > 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>

Reviewed-by: Peter Korsgaard <peter@korsgaard.com>

-- 
Bye, Peter Korsgaard

  parent reply	other threads:[~2024-02-27 16:53 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
2024-02-27 16:53 ` Peter Korsgaard [this message]
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=874jdtsvb1.fsf@48ers.dk \
    --to=peter@korsgaard.com \
    --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 \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox