2020-05-01 17:05:54

by Colin King

[permalink] [raw]
Subject: re: e1000: Add support for the CE4100 reference platform

Hi,

Static analysis with Coverity has detected an issue with setting the
speed control on the e1000 driver. This was introduced back in 2011 with
the following commit:

commit 5377a4160bb65ee4dd11b4b1d081d86d56d92bff
Author: Dirk Brandewie <[email protected]>
Date: Thu Jan 6 14:29:54 2011 +0000

e1000: Add support for the CE4100 reference platform

The Coverity analysis is as follows for function
e1000_config_mac_to_phy() in source
drivers/net/ethernet/intel/e1000/e1000_hw.c:

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 and it is being and-ed with 0x200000 and this always
is zero, so the E1000_CTRL_SPD_100 is never set.

Colin