Netdev List
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: net: phy: continue searching for C45 MMDs even if first returned ffff:ffff
Date: Mon, 20 Jul 2020 17:21:13 +0100	[thread overview]
Message-ID: <4131864f-9e3e-9814-5f4d-16c93648bce2@canonical.com> (raw)

Hi,

Static analysis by Coverity has found a potential issue with the
following commit in /drivers/net/phy/phy_device.c:

commit bba238ed037c60242332dd1e4c5778af9eba4d9b
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Sun Jul 12 19:48:15 2020 +0300

    net: phy: continue searching for C45 MMDs even if first returned
ffff:ffff

The analysis is as follows:

735         * for 802.3 c45 complied PHYs, so don't probe it at first.
736         */

dead_error_condition: The condition (devs_in_pkg & 0x1fffffffU) ==
0x1fffffffU cannot be true.

737        for (i = 1; i < MDIO_MMD_NUM && devs_in_pkg == 0 &&

const: At condition (devs_in_pkg & 0x1fffffffU) == 0x1fffffffU, the
value of devs_in_pkg must be equal to 0.

738             (devs_in_pkg & 0x1fffffff) == 0x1fffffff; i++) {

Logically dead code (DEADCODE)dead_error_line: Execution cannot reach
this statement: if (i == 30 || i == 31) {

To summarize, if devs_in_pkg is zero, then (devs_in_pkg & 0x1fffffffU)
== 0x1fffffffU can never be true, so the loop is never iterated over.

Colin

             reply	other threads:[~2020-07-20 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 16:21 Colin Ian King [this message]
2020-07-20 16:31 ` net: phy: continue searching for C45 MMDs even if first returned ffff:ffff Vladimir Oltean

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=4131864f-9e3e-9814-5f4d-16c93648bce2@canonical.com \
    --to=colin.king@canonical.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=vladimir.oltean@nxp.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