Netdev List
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Dirk Brandewie <dirk.j.brandewie@intel.com>,
	Jeff Pieper <jeffrey.e.pieper@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: phy speed setting issue: e1000: Add support for the CE4100 reference platform
Date: Sat, 16 Feb 2019 14:26:37 +0000	[thread overview]
Message-ID: <252dcb38-59fa-fa20-be59-26964b900349@canonical.com> (raw)

Hi,

Static analysis from CoverityScan has detected an issue with the speed
setup with the control setting in the e1000 driver.

Function e1000_config_mac_to_phy in
/drivers/net/ethernet/intel/e1000/e1000_hw.c, CoverityScan reports:

CID 140032 (#1 of 1): Operands don't affect result
(CONSTANT_EXPRESSION_RESULT)

result_independent_of_operands: phy_data & 0x200000 is always 0
regardless of the values of its operands. This occurs as the logical
operand of if.

1936                if (phy_data & RTL_PHY_CTRL_SPD_100)
1937                        ctrl |= E1000_CTRL_SPD_100;
1938                else
1939                        ctrl |= E1000_CTRL_SPD_10;


phy_data is a u16 however the 100 mbit speed bitmask is 0x200000, hence
the bitwise with phy_data will always result in zero, and so the ctrl is
never set to E1000_CTRL_SPD_100.

I'm not familiar with this hardware, so I'm not sure what appropriate
mask should be.

Issue was introduced with commit: 5377a4160bb6 ("e1000: Add support for
the CE4100 reference platform")

Colin

                 reply	other threads:[~2019-02-16 14:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=252dcb38-59fa-fa20-be59-26964b900349@canonical.com \
    --to=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=dirk.j.brandewie@intel.com \
    --cc=jeffrey.e.pieper@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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